On 07/21/2014 02:29 PM, Jörg Kreuzberger wrote:
Hm, following your suggestion i replace lines
if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
add_definitions( -DNDEBUG )
endif()

with
set_directory_properties( PROPERTIES COMPILE_DEFINITIONS_RELEASE 
"${COMPILE_DEFINITIONS_RELEASE};NDEBUG" )

${COMPILE_DEFINITIONS_RELEASE} does not expand the property but you could use set_property() with the APPEND flag for that.

NDEBUG is set by default for MinSizeRel, Release and RelWithDebInfo so you should have found it in the Release flags even without using the property (unless you override the default flags).

With
  set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_RELEASE "FOOBAR")

I get
  ./CMakeFiles/foo.dir/flags.make:CXX_DEFINES = -DFOOBAR
When configuring a Release build with the Makefiles generator.

Nils




--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to