[CMake] multiple cmake files in one directory
Bill Hoffman
bill.hoffman at kitware.com
Wed Sep 23 12:36:15 EDT 2009
th.tom at gmx.de wrote:
> hm, right - this would solve my problem, but sadly writing everything in one CMakeLists.txt file was not a clever idea, as the projects should be build independently.
>
> Another solution I had (someone posted that) is creating a subdirectory for every project and place the specific CMakeLists.txt file there. However, this would change the CMAKE_SOURCE_DIR to the projects subdirectory; what is kind of nasty.
>
> Any ideas to change the root back?
>
You should be able to use add_subdirectory for this. It supports out of
source source.
add_subdirectory can be given a full path to a source directory. So,
you should be able to "share" source dirs between projects. They will
get re-compiled for each project, but it should work.
-Bill
More information about the CMake
mailing list