View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006440CMakeCMakepublic2008-02-25 05:172008-04-21 15:22
ReporterFabien Lavignotte 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionCMake-2-6 
Summary0006440: Exception handling cannot be removed with VS 2005
DescriptionWhen the flags /EHsc and /GX are removed from CMAKE_CXX_FLAGS, the exception handling is not desactivated.
I found why, the VS generator writes in the vcproj : ExceptionHandling="FALSE"
This is not understood by VS 2005, the generator should writes : ExceptionHandling="0"
I have made the modification in line 1675 of cmLocalVisualStudio7Generator.cxx.
Replaces :
  this->FlagMap["ExceptionHandling"] = "FALSE";
by
  this->FlagMap["ExceptionHandling"] = "0";


It works with VS8 and VS71.
TagsNo tags attached.
Attached Fileszip file icon CMakeBug.zip [^] (2,962 bytes) 2008-04-17 12:19

 Relationships

  Notes
(0011351)
Matthew Hungerford (reporter)
2008-04-15 16:29

This issue is plaguing our use of cmake with visual studio 2005. Even if we edit window_cl.cmake in share/modules/platform to edit cmake_cxx_flags_init to remove EHsc, and CMAKE_CXX_FLAGS (and CMAKE_CXX_FLAGS_DEBUG) don't contain any instance of GX or EHsc, the system still defaults to /EHsc. If we set /EHa, it correctly goes to /EHa. It looks as if when nothing is set, the VS8 generator fills exceptionhandling=false instead of exceptionhandling=0 (from the fix in cmLocalVisualStudio7Generator.cxx). Fix from http://www.cmake.org/Bug/view.php?id=6440 [^] (id=0006440) works. Effects 2.4.8 and 2.6.0RC8.
(0011396)
Gerhard Grimm (reporter)
2008-04-16 11:22
edited on: 2008-04-16 11:25

A similar problem exists in the Visual Studio .NET 2003 generator of CMake 2.6.0-RC8. With /EHa specified as exception handling option instead of /EHsc, it generates ExceptionHandling="TRUE", where it should read ExceptionHandling="FALSE", since MSVC 7.1 always interprets "TRUE" as /EHsc.
CMake 2.5-20071119 was working correctly regarding this issue.

(0011407)
David Cole (manager)
2008-04-17 11:20

Fixed in CVS HEAD of CMake:
/cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v <-- Source/cmLocalVisualStudio7Generator.cxx
new revision: 1.223; previous revision: 1.222

Assigning to Bill for merging to the CMake-2-6 branch.

ggrimm, is there a "/GX" in your CMAKE_CXX_FLAGS? That would also turn on ExceptionHandling even if you specify "/EHa" instead of "/EHsc" -- you may need to remove a /GX as well... If that's not the case for you, could you please submit a small sample project that demonstrates your problem?
(0011408)
David Cole (manager)
2008-04-17 11:21

Bill, could you merge to CMake-2-6?
(0011410)
Gerhard Grimm (reporter)
2008-04-17 12:23

Hi David, I've attached a minimal sample. When using the Visual Studio .NET 2003 generator (using config_mvs7.bat in the "build" directory), the compiler will issue warning D4025 (which can't be suppressed, since it's a "command line warning").
When using the NMake Makefile generator (using config_nmake.bat), no such warning will appear during the build.
(0011429)
Matthew Hungerford (reporter)
2008-04-18 10:57

Tried the nightly build Window 2.7.20080418, and now exception handling works correctly (in that it is now disabled when we have no /GX /EHsc in the CMake_Flags). Looks great, hope it makes the 2.6 final release :) .
(0011444)
Gerhard Grimm (reporter)
2008-04-21 03:31
edited on: 2008-04-21 03:32

Hi David, I've tested CMake 2.7-20080421, it still exhibits the problem when using Visual Studio .NET 2003.

(0011447)
Bill Hoffman (manager)
2008-04-21 07:59

ggrimm, can you please provide a very small example that shows the problem?
(0011448)
Gerhard Grimm (reporter)
2008-04-21 08:10

Hi Bill, as stated in note 0011410 above, I've already attached a sample to this issue (CMakeBug.zip). I'm afraid it can't be done any simpler than with a single target and a single source file...
(0011449)
Bill Hoffman (manager)
2008-04-21 08:11

Never mind, I did not notice the example already attached. We will re-try with vs 2003 sounds like it works for vs2500.
(0011461)
Bill Hoffman (manager)
2008-04-21 14:51

OK, I found it...

This was a much bigger bug than what I thought it was...

Your flags in the cache were being ignored altogether! So, it was actually correctly turning exceptions on, because it was getting the /GX flag. I have checked in a fix that should solve the problem.
(0011463)
Bill Hoffman (manager)
2008-04-21 15:22

This should be fixed now.

 Issue History
Date Modified Username Field Change
2008-02-25 05:17 Fabien Lavignotte New Issue
2008-02-25 16:35 Alex Neundorf Category CCMake => CMake
2008-02-27 11:18 Bill Hoffman Status new => assigned
2008-02-27 11:18 Bill Hoffman Assigned To => Bill Hoffman
2008-04-15 16:29 Matthew Hungerford Note Added: 0011351
2008-04-16 10:07 Bill Hoffman Assigned To Bill Hoffman => David Cole
2008-04-16 11:22 Gerhard Grimm Note Added: 0011396
2008-04-16 11:25 Gerhard Grimm Note Edited: 0011396
2008-04-17 11:20 David Cole Status assigned => resolved
2008-04-17 11:20 David Cole Fixed in Version => CMake-2-6
2008-04-17 11:20 David Cole Resolution open => fixed
2008-04-17 11:20 David Cole Note Added: 0011407
2008-04-17 11:21 David Cole Assigned To David Cole => Bill Hoffman
2008-04-17 11:21 David Cole Status resolved => feedback
2008-04-17 11:21 David Cole Resolution fixed => reopened
2008-04-17 11:21 David Cole Note Added: 0011408
2008-04-17 12:19 Gerhard Grimm File Added: CMakeBug.zip
2008-04-17 12:23 Gerhard Grimm Note Added: 0011410
2008-04-18 10:57 Matthew Hungerford Note Added: 0011429
2008-04-21 03:31 Gerhard Grimm Note Added: 0011444
2008-04-21 03:32 Gerhard Grimm Note Edited: 0011444
2008-04-21 07:59 Bill Hoffman Note Added: 0011447
2008-04-21 08:10 Gerhard Grimm Note Added: 0011448
2008-04-21 08:11 Bill Hoffman Note Added: 0011449
2008-04-21 14:51 Bill Hoffman Note Added: 0011461
2008-04-21 15:22 Bill Hoffman Status feedback => closed
2008-04-21 15:22 Bill Hoffman Note Added: 0011463
2008-04-21 15:22 Bill Hoffman Resolution reopened => fixed


Copyright © 2000 - 2018 MantisBT Team