Sparse directory support with CMake 2.8

Alexander Neundorf neundorf at kde.org
Thu Mar 4 21:05:20 CET 2010


On Thursday 04 March 2010, Jonathan Marten wrote:

> Being able to have a sparse source tree is something that used to work, and
> is very useful for developers who don't want to track/build everything. 
> Would it be possible to fix this by changing
> MacroOptionalAddSubdirectory.cmake as follows?
>
> --- MacroOptionalAddSubdirectory.cmake    (revision 1098844)
> +++ MacroOptionalAddSubdirectory.cmake    (working copy)
> @@ -24,7 +24,7 @@
>
>  MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir )
>     GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE)
> -   IF(EXISTS ${_fullPath})
> +   IF(EXISTS ${_fullPath}/CMakeLists.txt)
>        IF(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES)
>           SET(_DEFAULT_OPTION_VALUE FALSE)
>        ELSE(DISABLE_ALL_OPTIONAL_SUBDIRECTORIES)
> @@ -37,5 +37,5 @@
>        IF(BUILD_${_dir})
>           ADD_SUBDIRECTORY(${_dir})
>        ENDIF(BUILD_${_dir})
> -   ENDIF(EXISTS ${_fullPath})
> +   ENDIF(EXISTS ${_fullPath}/CMakeLists.txt)
>  ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY)
>
> Also as a side effect, comment 1 at the top of the file would be true
> again!

I haven't actually tested it, but it seems to make a lot of sense.
So please commit.
If there are no issues, I think this should also go in the 4.4 branch.

Alex


More information about the Kde-buildsystem mailing list