[CMake] How to set a preprocessor define for all build configurations except one ?

Raphael Kubo da Costa kubito at gmail.com
Sun Jun 12 16:32:54 EDT 2011


Glenn Coombs <glenn.coombs at gmail.com>
writes:

> Is there a more elegant solution that I am missing ?  Ideally something
> like:
>
> add_definitions(CONFIG=Debug;Release;RelWithDebInfo;MinSizeRel
> -DGEN_OUTFILES)
>
> which I know doesn't exist but I really wish it did :-)

Isn't it OK to just do something like:

  if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "ReleaseNoOutFiles")
    add_definitions(-DGEN_OUTFILES)
  endif ()



More information about the CMake mailing list