View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014149CMakeCMakepublic2013-05-16 10:422013-10-07 10:09
ReporterDaniel Raviart 
Assigned To 
PriorityurgentSeverityblockReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindowsOS7OS Version7 64bits
Product VersionCMake 2.8.10.2 
Target VersionFixed in Version 
Summary0014149: /EHsc flag cannot be removed from CMAKE_CXX_FLAGS for Visual Studio 2010
DescriptionCMake 2.8.11-rc2
I tried several ways to remove the exception handling /EHsc flag from the cache.
1 - string(REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2 - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" FORCE )
3 - set( CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /GR" )
After each try, the variable is still the same in the cache:
//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING= /DWIN32 /D_WINDOWS /W3 /GR /EHsc
I am unable to remove the /EHsc flag.
I saw that this bug was reported here:
http://www.cmake.org/pipermail/cmake/2010-December/041638.html [^]
It is said that:
"This is because cmake automatically adds /EHsc to the command line
options."
If this is true, how do we do to remove this option?
Thanks in advance.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0033059)
Daniel Raviart (reporter)
2013-05-16 11:29

It seems that forcing the variable in the cache solves the problem:

set( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "Flags used by the compiler during all build types (Forced version)." FORCE )
(0033068)
Brad King (manager)
2013-05-16 12:58

The string(REPLACE) in your example does actually replace the flag that will be used for generation of the build system. The result is stored as a normal (non-cache) CMake variable that takes precedence over the cached one so it is used for generation but the change is not visible in the cache view without also using the FORCE cache set as you discovered.

You can also use CMAKE_USER_MAKE_RULES_OVERRIDE:

 http://www.cmake.org/cmake/help/v2.8.10/cmake.html#variable:CMAKE_USER_MAKE_RULES_OVERRIDE [^]

to set CMAKE_CXX_FLAGS_INIT early enough to take effect on the initial cache value.

Please ask on the mailing list if you need further help.

(0034049)
Robert Maynard (manager)
2013-10-07 10:09

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-05-16 10:42 Daniel Raviart New Issue
2013-05-16 11:29 Daniel Raviart Note Added: 0033059
2013-05-16 12:58 Brad King Note Added: 0033068
2013-05-16 12:58 Brad King Status new => resolved
2013-05-16 12:58 Brad King Resolution open => no change required
2013-10-07 10:09 Robert Maynard Note Added: 0034049
2013-10-07 10:09 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team