[Cmake] File and compiler specific flags?
Sebastien BARRE
sebastien at barre.nom.fr
Sun Aug 19 16:18:21 EDT 2001
Hi Bill, Amitha
Amitha, I would just like to add that you can also check the value of
CMAKE_CXX_COMPILER and matches it against a specific compiler. For example
(here for the Visual C++ 6.0, i.e. VC++60) :
IF (VTK_USE_ANSI_STDLIB)
IF (CMAKE_CXX_COMPILER MATCHES "^VC\\+\\+60$")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"NOMINMAX\"")
ENDIF (CMAKE_CXX_COMPILER MATCHES "^VC++60$")
ENDIF (VTK_USE_ANSI_STDLIB)
Furthermore :
At 17/08/2001 17:57, Bill Hoffman wrote:
>You guessed it:
>
>IF(CMAKE_COMPILER_IS_GNUCXX)
> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-50")
>ENDIF(CMAKE_COMPILER_IS_GNUCXX)
I's working, but there is a slight problem anyway : the new CMAKE_CXX_FLAGS
value does not make its way to the cache, although the original value has
the following syntax (here, for Windows) :
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE STRING
"Flags used by the compiler during all build types, /GX /GR are
for exceptions and rtti in VC++, /Zm1000 increases the compiler's memory
allocation to support ANSI C++/stdlib")
I guess we talked about that already privately Bill (and the fact that
there is no SET (VAR value CACHE TYPE) syntax) , but what is worrying me is
that even the SET (VAR value CACHE TYPE "doc string") syntax won't fix the
problem :
>IF(CMAKE_COMPILER_IS_GNUCXX)
> SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-50"
> CACHE STRING "new comment")
>ENDIF(CMAKE_COMPILER_IS_GNUCXX)
=> nothing is written to the cache
=> CMAKE_CXX_FLAGS is *not* changed, even internally (try with some bogus
option to make it crash : it won't).
More information about the CMake
mailing list