[CMake] How to make the target_link_libraries link different library in different build type.

Michael Wild themiwi at gmail.com
Mon May 17 00:59:53 EDT 2010


On 17. May, 2010, at 4:25 , SONGFY wrote:

>    The target_link_libraries has any three tag to distinguish different build type:debug|optimized|general.
>    But what I need is to specify different library in different build type, for example I have three custom build type: debug, release, shipping. And I want these configurations link to different version of library for example A_d.lib, A_r,lib and A_s.lib.
>    How can I do this?
>    Thank you.

Create an IMPORTED target, especially note the target properties IMPORTED_CONFIGURATIONS, IMPORTED_LOCATION_<CONFIG> and IMPORTED_IMPLIB_<CONFIG>. If the configuration names don't match, there's MAP_IMPORTED_CONFIG_<CONFIG>.

Michael



More information about the CMake mailing list