[CMake] Targets organisation of complex project
Chris Foster
chris42f at gmail.com
Sun Oct 11 22:32:14 EDT 2009
On Mon, Oct 12, 2009 at 12:15 PM, Philip Lowman <philip at yhbt.com> wrote:
> I would do what makes sense in terms of the end user. If those separate
> subdirectories are meant to be separate libraries, then build separate
> libraries. If the source code is scattered across multiple subdirectories
> but is all supposed to be part of the same library then build it together.
>
> You can use PARENT_SCOPE to hand lists of source files up a directory, if
> that is of interest.
> set(FOO_SRCS ${list_of_sources} PARENT_SCOPE)
Yeah, this is a pretty good approach. Unfortunately I had difficulty
with it because I needed to use code generation via
add_custom_command() to create some of the source files. I couldn't
seem to get the dependency resolution for the generated files to work
unless I had the custom command inside the *same* CMakeLists.txt which
built the library.
In the absence of code generation, I'd be inclined to go with PARENT_SCOPE.
~Chris
@ Philip: Apologies for the double mail, I'm unused to mailing lists
which require an explicit reply to the list :-/
More information about the CMake
mailing list