Doing in-source builds is generally considered a bad idea. Instead do
something like:

   ADD_SUBDIRECTORY (${prj} ${prj}/build)

Huh? That snippet above has absolutely nothing to do with in- source vs.
out-of-source builds. He simply accumulates all his subprojects in a
variable instead of listing each with its own add_subdirectory call.

I disagree. From the docs:

add_subdirectory: Add a subdirectory to the build.

Heh, didn't see the second argument :)

I always do out-of-source builds, believe me.

${prj} is a relative path, not an absolute path

in other words, I guess CMake interprets the command as

ADD_DIRECTORY (${CMAKE_CURRENT_SOURCE_DIR}/${prj} $ {CMAKE_CURRENT_BINARY_DIR}/${prj})

using ${prj}/build would be a bad idea, as every subproject would construct a build directory within the source tree.

all the subprojects are built into a build/ tree which is fully external from the source tree

Cheers,
Manu

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to