[CMake] How to add a target link library, but only for a custom configuration ?

Glenn Coombs glenn.coombs at gmail.com
Fri May 6 05:32:37 EDT 2011


On 6 May 2011 01:12, Michael Hertling <mhertling at online.de> wrote:

>
> Yes, absolutely. Although setups with libraries which are needed in some
> configurations only are quite rare, AFAIK, your case shows that this may
> well happen. ;-) Possible - and more appropriate - solutions could be:
>
> - New target properties, say, EXTRA_LINK_LIBRARIES[_<CONFIG>] that
>  are just added to the respective targets' link command lines.
> - Permission of empty or absent IMPORTED_LOCATION[_<CONFIG>]
>  properties; with these, you might just have said
>
> ADD_LIBRARY(pthreads SHARED IMPORTED)
> SET_TARGET_PROPERTIES(pthreads PROPERTIES
>     IMPORTED_LOCATION_DEBUGPTHREADS ${PTHREADS_LIBRARIES})
> TARGET_LINK_LIBRARIES(myLib pthreads)
>
> and that's it. Perhaps, this would be worth a feature request.
>
> Regards,
>
> Michael
>

I've filed a report on the bug tracker:

    http://public.kitware.com/Bug/view.php?id=12124

so hopefully something may get done about it sometime.

--
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110506/a05ced41/attachment.htm>


More information about the CMake mailing list