[Cmake] File and compiler specific flags?

Bill Hoffman bill . hoffman at kitware . com
Fri, 17 Aug 2001 17:57:04 -0400

You guessed it:

        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-50")

Right now, only isGNUCXX is set.  Which is similar to autoconf.
You could right cmake code to run the compiler -V to find out which one
it was.


At 05:23 PM 8/17/2001 -0400, Amitha Perera wrote:
>Is there a clean way to specify compile flags that depend on the
>compiler and on the file? For example, with gcc, xcv_geometry.cxx
>needs -ftemplate-depth-100.
>I noticed that there is now a variable CMAKE_COMPILER_IS_GNUCXX. Does
>it make sense to extend on this, and have many such variables
>(IS_SUNWORKSHOP, IS_MIPSPRO, IS_GNUCXX_30, ...) ? Something like this,
>combined with a command ADD_FLAGS( [target] flags ) would solve the
>problem above.
>For this particular problem, of course, I could put
>-ftemplate-depth-100 into the "global" compiler options. There are
>other occasions, though, where this is not feasible. For example, some
>files cannot be compiled with optimisation turn on because the
>compiler produces incorrect code.
>Cmake mailing list
>Cmake at public . kitware . com
>http://public . kitware . com/mailman/listinfo/cmake