[CMake] Extend FIND_LIBRARY to properly recognize debug libs
Christian Ehrlicher
Ch.Ehrlicher at gmx.de
Wed Sep 19 08:55:03 EDT 2007
> Von: Bill Hoffman
> Betreff: Re: [CMake] Extend FIND_LIBRARY to properly recognize debug libs
> 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})
>
We use this approach
FIND_LIBRARY(kdewin32 KDEWIN32LIB)
FIND_LIBRARY(kdwin32_d KDEWIN32LIB_D)
if(KDEWIN32LIB and KDEWIN32LIB_D)
set(KDEWIN32_LIBRARY optimized ... debug ...)
... checking all three possibilities
target_link_libraries(foo KDEWIN32_LIBRARY)
But I think I can put this into one macro which needs to be used all over kde.
Christian
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
More information about the CMake
mailing list