SPAM-MED: Re: [CMake] disabling features such as C++
Reggie Burnett
reggie at bytefx.com
Tue Feb 7 01:16:59 EST 2006
Bill
Thanks for the info. I got it going. Now I have another issue.
I have a project that has about 10 top level targets. Each of these are in
their own folder. In one of them I have a custom command that generates a
header file. This header file is used in several other top level targets.
I'm having a difficult time getting the header file to be generated. When I
attempt to build the target that comes from the cmakelists.txt that includes
the ADD_CUSTOM_COMMAND, it worked. However, when I tried to build one of
the other targets that also depends on the generated header, it's not
generated.
Can you help?
Reggie
> -----Original Message-----
> From: William A. Hoffman [mailto:billlist at nycap.rr.com]
> Sent: Monday, February 06, 2006 3:10 PM
> To: Reggie Burnett; cmake at cmake.org
> Subject: SPAM-MED: Re: [CMake] disabling features such as C++
>
> At 03:13 PM 2/6/2006, Reggie Burnett wrote:
> >Guys,
> >
> >Can you tell me how to disable a feature such as exception handling for a
> >project under cmake control? This is on Windows using Visual 7 and 8.
> >Looking in the platform files, I see that /EHsc is automatically added to
> >the build flags variable but I can't seem to find a good way to remove
> it.
> >
> >I've tried the brute force approach like so:
> >
> ># replace /MDd with /MTd
> >IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES
> >"Visual Studio 8")
> >STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT
> >${CMAKE_CXX_FLAGS_DEBUG_INIT})
> >STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT
> >${CMAKE_C_FLAGS_DEBUG_INIT})
> >STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE
> ${CMAKE_C_FLAGS_RELEASE})
> >STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
> >STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE
> >${CMAKE_CXX_FLAGS_RELEASE})
> >STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG
> ${CMAKE_CXX_FLAGS_DEBUG})
> >
> ># remove support for Exception handling
> >STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
> >STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
> >ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR
> MATCHES
> >"Visual Studio 8")
> >
> >However when I print out the variables with this:
> >MESSAGE("c init = ${CMAKE_C_FLAGS_INIT}")
> >MESSAGE("c debug init = ${CMAKE_C_FLAGS_DEBUG_INIT}")
> >MESSAGE("c release = ${CMAKE_C_FLAGS_RELEASE}")
> >MESSAGE("c debug = ${CMAKE_C_FLAGS_DEBUG}")
> >MESSAGE("c++ init = ${CMAKE_CXX_FLAGS_INIT}")
> >MESSAGE("c++ debug init = ${CMAKE_CXX_FLAGS_DEBUG_INIT}")
> >MESSAGE("c++ release = ${CMAKE_CXX_FLAGS_RELEASE}")
> >MESSAGE("c++ debug = ${CMAKE_CXX_FLAGS_DEBUG}")
>
>
> The _INIT stuff should not be changed. It is only used once to initialize
> the
> cache variables CMAKE_CXX_FLAGS*. You need to change:
> CMAKE_CXX_FLAGS
> CMAKE_CXX_FLAGS_RELEASE
> CMAKE_CXX_FLAGS_DEBUG, etc.
> Also, these are cache variables, so you will want to FORCE the change, or
> preload a cache.
>
> -Bill
>
>
More information about the CMake
mailing list