[CMake] VS2005: CMAKE_CXX_FLAGS not used when project() is placed after definition
Jens Auer
jensa at miltenyibiotec.de
Tue Sep 20 09:40:30 EDT 2011
Hi,
I encountered a problem with CMAKE_CXX_FLAGS and the place in the CMakeLists.txt where the project() command is placed. Consider two CMakeLists.txt files, the first containing
SET(CMAKE_CXX_FLAGS "/EHa /O2")
project(CMAKE_BUG)
add_executable(testEHa "c:/work/tmp/cmake_eha/test.cpp")
And the second containing
project(CMAKE_BUG)
SET(CMAKE_CXX_FLAGS "/EHa /O2")
add_executable(testEHa "c:/work/tmp/cmake_eha/test.cpp")
When I run cmake 2.8.5 on both files, the exception handling option differs. For the first file, it is set to 1 in the generated VS project file, which means /Ehsc, the default. The second file generates the intended project file with windows structured exceptions enabled.
I only checked the generated VS2005 files, so I don't know if this is an issue of this specific generator or a more global one.
Best regards,
Jens
More information about the CMake
mailing list