[CMake] decision based on being a nested project
Nathan Huesken
cmake at lonely-star.org
Tue Jun 8 15:00:16 EDT 2010
Hi,
As can be read in an earlier thread, I am trying to nest a cmake
project (call it "inner") into another cmake project (call it "outer").
The "inner" project should be extracable and run as its own project.
Having trouble with EXTERNALPROJECT_ADD, I am trying to add the project
as a subdir. So I have something like this:
- rootdir
CMakeFile: Project(outer)
- lib
CMakeFile: Add_Subdirectory(inner)
- inner
CMakeFile: Project(inner)
- doc
CMakeFile: Add_target(doc)
- doc
CMakeFile: Add_target(doc)
...
The problem now is, that the target "doc" exists twice, cmake
complaints.
So I would rename the inner target to "inner_doc", and add it as a
dependency of "doc".
But as said the inner project should also work on is own.
So I would do:
IF_IS_NESTED_PROJECT
add_target(inner_doc)
ELSE
add_target(doc)
ENDIF
My question: How can I find out if inner is configured as inner project
of outer or as a standalone project? (How can I do the
IF_IS_NESTED_PROJECT)?
Thanks!
Nathan
More information about the CMake
mailing list