[CMake] Re: Avoiding convenience libs
Matthew Woehlke
mw_triad at users.sourceforge.net
Tue Apr 17 17:55:44 EDT 2007
Pascal Fleury wrote:
> In a move to avoid convenience libraries, I have tried to store a list of
> files into a variable ("utils_SRCS"), and reuse this var in each target that
> would normally link to the convenience lib (potentially compiling these
> source files multiple times, but that is not the issue here).
> [snip file list]
> ---src/CMakeLists.txt---------
> ADD_SUBDIRECTORY( utils )
> ADD_SUBDIRECTORY( mylib )
>
> ---src/utils/CMakeLists.txt---------
> SET(utils_SRCS a.cpp b.cpp)
>
> ---src/mylib/CMakeLists.txt---------
> ADD_LIBRARY(mylib l1.cpp l2.cpp main.cpp ${utils_SRCS} )
>
> But now, in src/mylib/CMakeLists.txt, the ${utils_SRCS} is always empty,
> resulting in missing symbols when linking. I have tried to print some STATUS
> messages, and the control flow between the cmake scripts is what I expect,
> but the variable is defined only in the src/utils/CMakeLists.txt, after that,
> it's gone. What is the logic behind this ?
WAG: variables only propogate to children, not siblings (i.e. 'not to
later CMakeLists.txt's that are not children)? IOW, try moving your
SET() up to a common parent.
(hmm, an appropriate .sig...)
|
\|/
V
--
Matthew
This e-mail may have been sent in haste; if any of its contents are
offensive, inappropriate, inaccurate, ungrammatical, misspelled, or
incomplete, too bad.
More information about the CMake
mailing list