[CMake] Choosing between debug and release variants of third-party libraries

Torsten Martinsen tma at gatehouse.dk
Fri Nov 9 04:04:55 EST 2007


Philip Lowman <mailto:philip at yhbt.com> wrote:

> Torsten Martinsen wrote:
>> I'm sure this is a FAQ, but I cannot find the answer anywhere.
>>
>> Using VS 2003, given that I have a third-party library with debug
>> and release variants:
>>
>>     /path/to/lib/release/lib.lib
>>     /path/to/lib/debug/lib.lib
>>
>> how do I get CMake to link with the correct variant? Using an
>> absolute path in TARGET_LINK_LIBRARIES() does not work, and I cannot
>> use CMAKE_BUILD_TYPE at configure time.
>
> #  TARGET_LINK_LIBRARIES: Link a target to given libraries.
>
>   TARGET_LINK_LIBRARIES(target library1
>                         <debug | optimized> library2
>                         ...)

That's what I tried, but the third-party libraries are located outside my build tree, so I need to use absolute paths, which as I said does not work:

        It is impossible to order the linker search path in such a way that libraries specified as full paths will be picked by the linker.
        Directories and libraries involved are:
        Directory: c:/lang/Qt/3.3.4/lib contains:
        Library: c:\lang\qt\3.3.4r/lib/qtmain.lib

        Directory: c:/lang/qt/3.3.4r/lib contains:
        Library: C:\lang\Qt\3.3.4/lib/qtmain.lib

-Torsten

This e-mail and any files sent with it contain information that may be privileged or confidential and is the property of the GateHouse Group. This information is intended solely for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use the message or any part thereof. If you have received this e-mail in error, please notify the sender immediately, and delete all copies of this message. In accordance with GateHouse Security Policy, e-mails sent or received may be monitored.


More information about the CMake mailing list