[CMake] COMPILE_DEFINITIONS_Debug doesn't work in Windows
Rolf Eike Beer
eike at sf-mail.de
Tue Apr 17 04:04:16 EDT 2012
> Hi All!
>
> I need to add some preprocessor definitions to my target.
> Here is the code:
>
> if (WIN32)
> set (COMPILE_DEFINITIONS_Debug
> _DEBUG
> USE_MP3READER2
> _EXPORTS
> _USRDLL
> _CRT_SECURE_NO_WARNINGS
> _USE_32BIT_TIME_T
> )
>
> set (COMPILE_DEFINITIONS_Release
> NDEBUG
> USE_MP3READER2
> _EXPORTS
> _USRDLL
> _CRT_SECURE_NO_WARNINGS
> _USE_32BIT_TIME_T
> )
> else(WIN32)
>
> set (COMPILE_DEFINITIONS_Debug
> _DEBUG
> USE_MP3READER2
> )
>
> set (COMPILE_DEFINITIONS_Release
> NDEBUG
> USE_MP3READER2
> )
> endif(WIN32)
>
>
> But when I open Debug configuration of my VS2008 project I see
>
> WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\"
>
> Does someone happen to know how to fix it?
COMPILE_DEFINITIONS is not a variable, it's a global property. As such you
need to call
set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG "...")
Please note that you also need to uppercase the build type.
Eike
More information about the CMake
mailing list