[CMake] help with variable usage in target_link_libraries
Eric Noulard
eric.noulard at gmail.com
Mon Aug 31 02:41:12 EDT 2009
2009/8/31 Eike Kroemer <eike-michael.kroemer at atlas-elektronik.com>:
> Hi there,
>
> using cmake-2.6.4-Linux-i386, I'd like to use
>
> set(LIBS lib1)
> set(LIBS "$LIBS lib2")
> [...]
> set(LIBS "$LIBS libN")
>
> target_link_libraries(target $LIBS)
>
> instead of writing explicitely
>
> target_link_libraries(target lib1 lib2 [...] libN)
>
> but while cmake gives no error messages, the library dependencies are
> not honored during link.
> I tried to vary the usage of '"'s but to no avail.
>
> How to do it correctly?
Variable values shoud be retrieve with curly brace, i.e.
$LIBS --> ${LIBS}
Then when you have a list of something you usually use LIST(APPEND
LIST(APPEND LIBS "libN")
even if
SET(LIBS "${LIBS} libN") should work as well.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list