[CMake] Re: Convenience libraries
Brad King
brad.king at kitware.com
Fri Jul 7 11:23:44 EDT 2006
John Ellson wrote:
> 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
As long as lib/gvc is processed after lib/graph:
GET_DIRECTORY_PROPERTY(
graph_SRCS
DIRECTORY ${PROJECT_SOURCE_DIR}/lib/graph
DEFINITION graph_SRCS
)
However you will have to reference the sources by their full path so
that they can be found in the other directory.
You could also create lib/graph/sources.cmake with this code:
SET(graph_SRCS
${PROJECT_SOURCE_DIR}/lib/graph/attribs.c
${PROJECT_SOURCE_DIR}/lib/graph/agxbuf.c
...)
and then INCLUDE it in both CMakeLists.txt files.
-Brad
More information about the CMake
mailing list