[CMake] Config Dependent Link Paths

Eric Noulard eric.noulard at gmail.com
Wed Aug 19 15:50:16 EDT 2009


2009/8/19  <aaron.meadows at thomsonreuters.com>:
> Background:
>        * I am moving from Visual Studio 2008 projects to Cmake in
> preparation
>          for porting our software to Linux.
>
>        * We have debug and release versions of 3rdparty libraries to
> link
>          against in two separate paths but under the same name.
>                (debug/library1.lib & release/library1.lib are debug and
>                release builds of the same library)
>
> Question:
>        With the "multi-configuration generator" for Visual Studio, how
> can I configure my root CMakeList.txt file to setup these two separate
> link paths based on which configuration is used?

I did not tried this but

target_link_libraries(<target> [lib1 [lib2 [...]]]
                             [[debug|optimized|general] <lib>] ...)

may be used to specify specific library like in:

target_link_libraries(myapp debug /full/path/to/debug/library1.lib)
target_link_libraries(myapp optimized /full/path/to/release/library1.lib)



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list