Christoph Cullmann wrote:
we have a strict set of C/CXX/LDFLAGS we want to pass the toolchain per
default, how can that be accomplished best with cmake? Before, we just used
nmake with handcrafted files using some environment variables.
At my work, we have the same problem, and we want the compile switches to be in
the build scripts so we can be relatively sure no one with a broken environment
will do a bad build. Here is what we do:
# Somewhere before the first PROJECT() command:
SET(CMAKE_USER_MAKE_RULES_OVERRIDE override.cmake)
# You could also have language specific files:
SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX override_cxx.cmake)
SET(CMAKE_USER_MAKE_RULES_OVERRIDE_C override_c.cmake)
# The file you specified will be read before the platform file.
# Then in override.cmake you can set your flags. Note the _INIT
# suffix on the variable names.
SET(CMAKE_CXX_FLAGS_INIT ${cxx_flags})
SET(CMAKE_CXX_FLAGS_DEBUG_INIT ${cxx_flags_debug})
SET(CMAKE_CXX_FLAGS_RELEASE_INIT ${cxx_flags_release})
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT ${cxx_flags_rwd})
--
Daniel
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake