https://bugzilla.redhat.com/show_bug.cgi?id=2023307
--- Comment #7 from Petr Menšík pemensik@redhat.com --- EPEL 7 is quite old these days. New package should not start today with standard of EPEL7 package. At least for EPEL 8 all macros should behave very close to current Fedora best practices.
EPEL 7 would probably need some tweaks anyway. Having the spec 100% identical for all different releases is not desirable. Especially when oldest supported epel releases are considered.
I think cmake3 variants have to be used instead.
BuildRequires: cmake3
Then something similar should work also on EPEL7:
%build %cmake3 %cmake3_build
%install %cmake3_install
But cmake3 is not present on Fedora, I think those macros would not work on both versions without some modification. My test build failed because there is no libyang >= 2 even for older stable Fedora releases, let alone for EPEL7.
I think you should use at least %set_build_flags macro to export all flags before cmake call. I would like you to reconsider decision to not use %cmake macros at all. While it is possible doing the same thing without them, they would bring you much of additional work. I think it is easier to keep multiple versions with small enough differences. Just do not reinvent the wheel. I am not sure if SuSE rpm spec allows compatible work with cmake, may need something different.