[CMake] ADD_SUBDIRECTORY() with a higher level directory

J Decker d3ck0r at gmail.com
Sun Nov 6 13:49:13 EST 2011


>
> Of course, the CMakeLists.txt in examples (or example0 and example1) depends
> on the actual library, so, from that level, we would like to call
> ADD_SUBDIRECTORY() to the *higher level* library directory... which is
> unacceptable for ADD_SUBDIRECTORY() (and probably conflicts with the whole
> CMake structure).
>
> If we would move examples "up" the hierarchy there wouldn't be a problem,
> but that doesn't give a nice distribution package.
>
> Any hints on a proper way to do this?

I include higher level projects all over; you just have to specify an
additional directory which is where that is built in the final output
so you can do
add_subdirectory( ../../whatever/example  __/__/whatever/example)
which builds into the __/__ path in the build directory...


More information about the CMake mailing list