[CMake] How to specify library dependencies?

Robert Dailey rcdailey at gmail.com
Tue Nov 25 17:18:45 EST 2008


On Tue, Nov 25, 2008 at 4:09 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> On Mon, Nov 24, 2008 at 4:39 PM, Michael Jackson <
> mike.jackson at bluequartz.net> wrote:
>
>> One of the better sources to look at is FindBoost.cmake:
>>
>> Here are some CMake Predefined variables that you will find useful:
>> APPLE
>> CYGWIN
>> MSVC
>> UNIX
>> WIN32
>>
>> You can use the cmake --help-variable [variable] for more information if
>> you have the command line handy.
>>
>> You may also might need to parse the contents of the CMAKE_SYSTEM variable
>> or the CMAKE_HOST_SYSTEM variable. Look at the docs for the differences
>> between them.
>>
>> CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME may also come in handy.
>
>
> What about for library dependencies for different build configurations,
> such as release and debug?
>
> Suppose I have a_d.lib and a_d.o for debug, and a.lib and a.o for release.
> What would I do in this case? Must I use the if conditionals for this as
> well? Not sure how CMake handles this common scenario.
>

I think I found the solution:

target_link_libraries( MyProject
    debug a_d
    optimized a
)

Is this correct?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081125/68b7ba48/attachment.htm>


More information about the CMake mailing list