[CMake] Extend FIND_LIBRARY to properly recognize debug libs
Bill Hoffman
bill.hoffman at kitware.com
Wed Sep 19 10:03:16 EDT 2007
Christian Ehrlicher wrote:
>> Von: Bill Hoffman <bill.hoffman at kitware.com>
>> Christian Ehrlicher wrote:
>>
>>>>
>>>>
>>> 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.
>>
>>>
>>>
>> OK, that looks good. So, what is the feature you want, and how would
>> it be used in this case?
>>
>>
> I just wanted to avoid the above code except two lines:
>
> FIND_LIBRARY_NEW(kdewin32 DEBUG_POSTFIX "_d" KDEWIN32_LIBRARY)
> target_link_libraries(foo KDEWIN32_LIBRARY)
>
> --> FIND_LIBRARY_NEW should do the job of selecting the correct libs for me :)
>
> But it shouldn't be to hard to put this into a macro. I'll take a look :)
>
> Christian
>
>
OK, so you want FIND_LIBRARY to find both libraries, the API for
FIND_LIBRARY is already pretty complicated, this maybe best as
as macro.
-Bill
More information about the CMake
mailing list