Dne Ne 11. srpna 2013 15:47:18, Jan Engelhardt napsal(a):
On Sunday 2013-08-11 14:27, Tomáš Chvátal wrote:
I got quite bored by fixing issues one by one adjusting spec files wrt cmake usage. Thus I went out and wrote cmake.macros for our beloved cmake and put it into my home project [1].
Basically now you just call %cmake -Dmydef=on -Dsomethingelselocal=/var/ instead of having to fiddle with all the variables yourself.
Have you attempted using -DCMAKE_C_FLAGS_RELEASE:STRING="%optflags"?
That might in theory work, but the best we thought up for gentoo was to create own target because this always caused some issues. Basically you put there something like -DCMAKE_USER_MAKE_RULES_OVERRIDE="/path/opensuse.cmake" And then override whole set. What I wrote in Gentoo: local build_rules=${BUILD_DIR}/gentoo_rules.cmake cat > "${build_rules}" <<- _EOF_ SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE) SET (CMAKE_C_COMPILER $(type -P $(tc-getCC)) CACHE FILEPATH "C compiler" FORCE) SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) SET (CMAKE_CXX_COMPILER $(type -P $(tc-getCXX)) CACHE FILEPATH "C++ compiler" FORCE) SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE) _EOF_ Basically we could install this rule file with cmake too and then just make sure its used.