[CMake] Attempting to use /EHa with Visual Studio .NET 2003
Gerhard Grimm
ggrimm at detec.de
Wed Nov 14 09:21:46 EST 2007
Hello there,
using the CMake 2.4.7 Visual Studio .NET 2003 generator, I'm trying to compile some code using the /EHa compiler option (enabling both asynchronous and C++ exception handling), but always end up with /EHsc (only handle C++ exeptions) as effective option in the generated project. Here's what I did:
Approach #1 (local)
add_executable(myexe mysrc.cpp)
set_target_properties(myexe PROPERTIES COMPILE_FLAGS "/EHa")
Approach #2 (global)
To configure the project, I run:
cmake -C InitialCache_mvs.txt -G "Visual Studio 7 .NET 2003" ..\..\src
The file "InitialCache_mvs.txt" contains a line:
set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHa" CACHE STRING "Flags used by the C++ compiler during all build types.")
In both cases, the .vcproj file contains the sequence:
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=" /Zm1000"
...
ExceptionHandling="2"
... />
resulting in /EHsc being passed to the compiler.
After changing the project manually to compile with /EHa (you need to disable exception handling and provide it as additional option), this sequence looks like:
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=" /Zm1000 /EHa"
...
ExceptionHandling="FALSE"
... />
Having searched for and read previous posts regarding this issue (June 2006), it looks like ExceptionHandling="2" is only understood by Visual Studio 2005, but not by .NET 2003.
Best regards, Gerhard
More information about the CMake
mailing list