But this
if (WIN32)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_DEBUG USE_MP3READER2 DLL_EXPORTS _USRDLL _CRT_SECURE_NO_WARNINGS _USE_32BIT_TIME_T) set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_RELEASE USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T)
else(WIN32)
set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_DEBUG USE_MP3READER2) set_property(TARGET ${lib_name} PROPERTY COMPILE_DEFINITIONS_RELEASE USE_MP3READER2)
endif(WIN32)

works fine, thanks!


17.04.2012 11:19, Vyacheslav Karamov написал:
It also doesn't work

set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_DEBUG "USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T") set_property(GLOBAL PROPERTY COMPILE_DEFINITIONS_RELEASE "USE_MP3READER2;DLL_EXPORTS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T")

17.04.2012 11:04, Rolf Eike Beer написал:
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
--

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


--

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
--

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

Reply via email to