[CMake] Debug / release build types

David Aldrich David.Aldrich at EMEA.NEC.COM
Tue May 17 10:29:35 EDT 2011


Hi Yuri

Thanks for your answer. I chose to use the OPTIMIZED and DEBUG keywords in target_link_libraries for simplicity.

Best regards

David

From: Yuri Timenkov [mailto:yuri at timenkov.ru]
Sent: 17 May 2011 11:57
To: David Aldrich
Cc: cmake at cmake.org
Subject: Re: [CMake] Debug / release build types

The best way is to use imported targets, specifying different locations for each configuration (http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets).

Or simply use OPTIMIZED and DEBUG keywords in target_link_libraries (see command help).
On Tue, May 17, 2011 at 1:42 PM, David Aldrich <David.Aldrich at emea.nec.com<mailto:David.Aldrich at emea.nec.com>> wrote:
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


_______________________________________________
Powered by www.kitware.com<http://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



Click here<https://www.mailcontrol.com/sr/Ylq8xTHIEMLTndxI!oX7UlEvFrFJ1EkCTuwXX7tNhVsUXjM!FWbGhjHZr!vQ4QakSeCdy7MqYwRrzgsKYpIG1w==> to report this email as spam.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110517/54dc13dc/attachment.htm>


More information about the CMake mailing list