[CMake] Attempting to use /EHa with Visual Studio .NET 2003 - no luck yet

Gerhard Grimm ggrimm at detec.de
Fri Nov 16 04:02:59 EST 2007


Hello there,

the latest CVS version of CMake (2.5-2007116) still exhibits the problem outlined below. It appears to be a bug in the Visual Studio .NET 2003 generator - to VS2003, the "ExceptionHandling" property is boolean and results in /EHsc if activated.

Best regards, Gerhard

-----Ursprüngliche Nachricht-----
Gesendet: Mittwoch, 14. November 2007 15:22
An: cmake at cmake.org
Betreff: [CMake] Attempting to use /EHa with Visual Studio .NET 2003


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