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.aldr...@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 > > 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