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

Glenn Coombs glenn.coombs at gmail.com
Sun Jun 12 18:25:25 EDT 2011


I don't think CMAKE_BUILD_TYPE is used by the Visual Studio generators so
that would only work for Makefile based build systems.  I need a solution
that works for both Visual Studio on Windows and Makefiles on Linux.

On 12 June 2011 21:32, Raphael Kubo da Costa <kubito at gmail.com> wrote:

> 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 ()
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110612/36b47373/attachment.htm>


More information about the CMake mailing list