[CMake] How to remove _WINDOWS for MSVC preprocessor definitions for library & executable projects?

Eric Noulard eric.noulard at gmail.com
Tue Jul 14 17:00:43 EDT 2009


2009/7/14 Erwin Coumans <erwin.coumans at gmail.com>:
>> string (REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
>
> Great, that did the job.
>

Don't know if it can work for your case but you have the
'remove_definitions' command too:

  remove_definitions
       Removes -D define flags added by add_definitions.

         remove_definitions(-DFOO -DBAR ...)

       Removes flags (added by add_definitions) from the compiler command
       line for sources in the current directory and below.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list