[CMake] Filtering out libraries in custom toolchain

Eric Gross eric.gross at ni.com
Thu Jan 9 19:21:53 EST 2014


Hi all,

We have a 3rd-party project that builds on multiple OSes via CMake, with 
one of them being VxWorks using a custom toolchain (fairly specific to our 
platform/tools). This project consists of multiple shared libraries with a 
fairly complex hierarchy,

All of this was working just fine until this project was updated to 
include a few static libraries as well. The issue I am running into is 
that VxWorks doesn't really have a concept of DLLs linking to each other, 
so our toolchain file currently neglects to bother passing 
<LINK_LIBRARIES> into the linker command line. However, now that we have 
static libraries, it suddenly needs to do this, since <LINK_LIBRARIES> 
includes both static and shared libraries (although these can be 
differentiated via extension).

Basically, I need to filter our <LINK_LIBRARIES> to only include static 
libs but not shared libraries. I can't really modify the dependencies at 
the outer layer to just remove non-static dependencies, because this 
removes the build-order-dependency information that CMake needs (some 
components generate files needed by others to build).

What is confusing me is that the syntax for creating toolchain command 
lines is "special" with variables in angle brackets and I'm not sure how 
best to do this. Our toolchain file looks something like this:

    set(CMAKE_CXX_CREATE_SHARED_LIBRARY
        "<CMAKE_C_COMPILER> <OBJECTS> -o <TARGET> ...

and I need it to look something like this:

    set(CMAKE_CXX_CREATE_SHARED_LIBRARY
        "<CMAKE_C_COMPILER> <OBJECTS> <LINK_STATIC_LIBRARIES> -o <TARGET> 
...

Can anyone give me some advice on how to create this 
"LINK_STATIC_LIBRARIES" behavior (versus "LINK_LIBRARIES") ?

Thanks,
Eric Gross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140109/e664dd8d/attachment.htm>


More information about the CMake mailing list