[CMake] ADD_SUBDIRECTORY

George Neill georgen at neillnet.com
Wed Dec 19 16:44:50 EST 2007


Hi CMakers,

I have a simple example.   I am curious why CMake doesn't
automatically build a psuedo-target when an ADD_SUBDIRECTORY is
issued?

In the end, I want be able to type 'make libs'.  I was able to get it
to work by adding ADD_CUSTOM_TARGET(libs DEPENDS A B), but adding it
seems somewhat redundant.

example/CMakeLists.txt contains,

PROJECT(EXAMPLE C)
ADD_SUBDIRECTORY(libs)
ADD_CUSTOM_TARGET(libs DEPENDS A B)

example/libs/CMakeLists.txt contains,

PROJECT(LIBS C)
ADD_SUBDIRECTORY(A)
ADD_SUBDIRECTORY(B)

example/libs/A/CMakeLists.txt contains

PROJECT(A C)
ADD_EXECUTABLE(A A.c)

example/libs/B/CMakeLists.txt contains

PROJECT(B C)
ADD_EXECUTABLE(B B.c)

TIA,
George.


More information about the CMake mailing list