[CMake] Debug / release build types

David Aldrich David.Aldrich at EMEA.NEC.COM
Tue May 17 05:42:44 EDT 2011


Hi

My understanding is that cmake will automatically set the compiler flags based on CMAKE_BUILD_TYPE.  I am wondering whether there is a clean way of specifying debug / release 'extra' libraries such that cmake will select the appropriate library at link time?

Currently I use this code to link to the open source 'SystemC' library:

if( USE_SYSTEMC )
    if( CMAKE_BUILD_TYPE STREQUAL "Release" )
        target_link_libraries( zodiac ${SYSTEMCLIB_R} )
    endif( CMAKE_BUILD_TYPE STREQUAL "Release" )
    if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
        target_link_libraries( zodiac ${SYSTEMCLIB_D} )
    endif( CMAKE_BUILD_TYPE STREQUAL "Debug" )
endif( USE_SYSTEMC )

Is there a cleaner way of doing this?

Best regards

David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110517/c2e8db2a/attachment-0001.htm>


More information about the CMake mailing list