[CMake] Problem with Debug target options in VS8

J.D. Yamokoski yamokosk at ufl.edu
Tue Nov 21 09:50:03 EST 2006


I feared this might come down to a project-specific problem. If I wrote 
the code, I would be much more comfortable trying to fix it. 
Nevertheless, here is the only think I could find in the cmake files 
that relates to setting the build type:

IF ( NOT CMAKE_BUILD_TYPE )
   IF ( NOT WIN32 )
     SET( CMAKE_BUILD_TYPE Release )
   ELSE ( NOT WIN32 )
     # windows... a temp hack: VCC does not seem to respect the cmake
     # setting and always defaults to debug, we have to match it here.
     SET( CMAKE_BUILD_TYPE Debug )
   ENDIF ( NOT WIN32 )
   MESSAGE( STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'" )
ELSE ( NOT CMAKE_BUILD_TYPE )
   MESSAGE( STATUS "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
ENDIF ( NOT CMAKE_BUILD_TYPE )

Anything glaringly wrong with this code?

J.D.

Bill Hoffman wrote:
> J.D. Yamokoski wrote:
>> Greetings,
>>
>> First I just want to say that I am a new cmake user and I am loving 
>> it! Great stuff!
>>
>> On to my issue, I apologize if this is a known issue or posted before, 
>> but I have had some trouble with with Cmake and VS8. The error I get 
>> is that cmake generates two incompatible compiler options for the 
>> Debug target of a certain open source library. Specifically, VS 
>> complains:
>>
>> cl : Command line error D8016 : '/O2' and '/RTC1' command-line options 
>> are incompatible
>>
>> I know what those options are and why they are incompatible but what I 
>> don't know is whether this is a cmake problem or an issue with this 
>> project's cmake files. I have already talked to the developers of the 
>> library I am trying to compile. They state that they "only ever set 
>> CMAKE_BUILD_TYPE to 'Debug' for Windows but certainly don't set any 
>> flags anywhere".
>>
>> For the time being, I have circumvented the problem by changing my 
>> target to a Release build. But I would like to find out how to turn 
>> off code optimization for the Debug build.
> This sounds like a bug in the CMakeLists.txt files of the project you 
> are working with.   By default CMake does not do this.
> However, it is possible to set the flags incorrectly in a CMakeLists.txt 
> file to get this result.   You would have to post more information
> about the project you are wrapping to get more help.
> 
> -Bill
> 
> 


More information about the CMake mailing list