[CMake] Re: Convenience libraries

Manuel Klimek klimek at box4.net
Fri Jul 7 11:26:56 EDT 2006


Hi,

just as a hint, I solved it the following way:
lib/a/a.cmake
lib/b/b.cmake
lib/c/c.cmake
lib/c/CMakeLists.txt

now the .cmake files just contain conveniently named
variables (a_SRC, b_SRC, c_SRC)
and in lib/c/CMakeLists.txt I use a macro like
MY_LIBRARY( c SHARED ../a/a.cmake ../b/b.cmake ../c/c.cmake )
which includes ../a/a.cmake etc. and adds a_SRC etc. to the
current dll's source file list. This way you can even
generate source groups for visual studio automagically...

using this pattern, it's very easy to switch a collection
of source files (aka. 'convenience lib') from one dll into another...

hope that helps,
Manuel

> Brad King wrote:
>>
>> I've just added it to the FAQ:
>>
>> http://www.cmake.org/Wiki/CMake_FAQ#Does_CMake_support_.22convenience.22_libraries.3F
>>
>>
>> Note that KDE used to use convenience libraries and is doing just fine
>> without them.  They were really a hack in auto* because those tools
>> did not support source files from a different directory when
>> convenience libraries were first created.
>>
>> -Brad
>
> Thanks, ok but, sorry to be thick, how do I reference a symbol defined
> in CMakeLists.txt in another directory for a list of source files?
>
> e.g. in lib/graph/CMakeLists.txt I have:
>     SET(graph_SRCS
>           attribs.c agxbuf.c edge.c graph.c graphio.c lexer.c node.c
> parser.c refstr.c trie.c
>     )
> and I want to expand this in lib/gvc/CMakeLists.txt
>
> John
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>
>



More information about the CMake mailing list