[CMake] Problem with design and ADD_SUBDIRECTORY
Tyler Roscoe
tyler at cryptio.net
Tue Jul 14 11:31:07 EDT 2009
On Tue, Jul 14, 2009 at 12:08:43PM -0300, Martin Santa María wrote:
> root/
> CMakeLists.txt -> generates executable with some package libraries
> package1/
> CMakeLists.txt -> generates package1.lib
> package2/
> CMakeLists.txt -> generates package2.lib that depends on package1 library and its header files. so it must include root/package1/
>
>
> My problem begins with INCLUDE_DIRECTORIES and LINK_DIRECTORIES. I
> would like that packages include those directories that are really
> needed to search for headers and libraries, in the previous example
> package2 should includes directory package 1 so it could find
> package1's headers, but package1 shouldn't know about package2. To
Why does it matter if package1 "knows about" package2? What do you mean
by "know about"?
> archive this, I think I need to use ADD_SUBDIRECTORY so each sub
> directory has its own includes and libraries directories. The problem
Yes, the root project should probably add_subdirectory() both package
projects. Is this not how you're doing it now?
> is that the root CMakeLists.txt should known the list of generated
> libraries and source files so it could make the global executable. I
> don't find the way to pass this information from package's
> CMakeLists.txt to the root CMakeLists.txt.
I'm afraid I still don't understand the problem, or your question.
set() has a PARENT_SCOPE flag that might help you? But I have a feeling
you're over-thinking this.
tyler
More information about the CMake
mailing list