Hi there,
I'm relatively new to CMake. I'm trying to build a 3rd party library
under Windows. (The 3rd party library happens to be an old-ish version
of ITK.) I want to add a compile flag (/bigobj) during the cache priming
step, but I can't figure out how to do it. Either my changes get
ignored, or I overwrite the default flags completely which is not what I
want either. I just want to add my flag to the default flags for all
compile steps.
Here's what I'm doing: I have a file called prime_cache.cmake, and I
invoke CMake like so:
cmake -C prime_cache.cmake ..\the_source_code
prime_cache.cmake contains this:
set(COMPILE_FLAGS /bigobj)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILE_FLAGS}" CACHE STRING "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}" CACHE STRING "")
When CMake is done, CMakeLists.txt contains this:
CMAKE_C_FLAGS:STRING= /bigobj
But I want this:
CMAKE_C_FLAGS:STRING= /bigobj /DWIN32 /D_WINDOWS /W3
I've also tried modifying CMAKE_C_FLAGS_INIT, but that didn't affect
CMAKE_C_FLAGS.
I realize that I can hand-edit CMakeCache.txt to get the flags I want,
but this is a small part of a much larger process and hand-editing is
tedious and error-prone so I want to avoid it if possible.
I'm using CMake 2.8.12.2 and would prefer to continue using this version
even though it's not current.
Thanks for a great tool,
Philip
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake