[CMake] Extend FIND_LIBRARY to properly recognize debug libs
Bill Hoffman
bill.hoffman at kitware.com
Wed Sep 19 08:34:54 EDT 2007
Christian Ehrlicher wrote:
> Hi,
>
> For now cmake has the option to set a debug postifx for debug libs/executables by one simple command:
>
> set(CMAKE_DEBUG_POSTFIX "_d")
>
> It would be nice to extend FIND_LIBRARY in a way that its possible to give that debug postfix so avoid code duplication everywhere you want to explicit set a different debug and release lib.
> e.g. FIND_LIBRARY(kdewin32 DEBUG_POSTFIX "_d" ...)
>
> Is it possible to add such a functionality for 2.6?
>
Why not:
FIND_LIBRARY(NAMES kdewin32 kdewin32_d ...)
However, if there are two different types of libs, you will want to
store them in separate
variables anyway. As you will have to use them differently.
FIND_LIBRARY(kdewin32 KDEWIN32LIB)
FIND_LIBRARY(kdwin32_d KDEWIN32LIB_D)
...
target_link_libraries(foo optimized ${KDEWIN32LIB} debug ${KDEWIN32LIB_D})
-Bill
More information about the CMake
mailing list