[CMake] Supporting large numbers of projects
Bill Hoffman
bill.hoffman at kitware.com
Thu Mar 27 16:11:12 EDT 2008
KSpam wrote:
> My company is using CMake to build a large number of projects (~300). The
> developers have complaints regarding the size (and load-time, etc) of the
> top-level solution file. I am attempting to address their concerns.
>
> Take this hypothetical project hierarchy:
>
> module-1/
> sub-module-1/
> project-1
> ...
> sub-module-n/
> project-n/
> ...
> module-n/
> sub-module-1/
> project-1/
> sub-module-n/
> project-n/
>
> In Linux, I can simply change to module-1/sub-module-1/project-1 and build
> from there. Any dependencies of the project will automatically be built as
> well. Unfortunately, this does not work with Visual Studio on Windows. On
> Windows, the dependencies are not automatically built when opening up a lower
> level solution file. Will this be addressed in CMake 2.6?
>
> One option I have given to the users is the ability to switch between source
> and binary modules or sub-modules. For instance, the project would have the
> following options:
>
> MY_BUILD_module-1:BOOL
> MY_BUILD_sub-module-1:BOOL
> ...
> MY_BUILD_module-n:BOOL
> MY_BUILD-sub-module-n:BOOL
>
> When all of the projects are built, I can manually switch off the build
> options for some of the modules and sub-modules. This allows us to create
> partial-source deliverables to customers (i.e. module-1 is delivered as
> headers and libs, and module-n is delivered as source). This also reduces
> the complexity of the top-level solution file. Additionally, this allows us
> to build sets of code against tagged release binaries.
>
> To accomplish this scheme, I have to manipulate "*_LINK_TYPE", "*_LIB_DEPENDS"
> variables for modules and sub-modules that are turned OFF (I am using
> INTERNAL CACHE variables for this). I found that I have to configure twice
> prior to generating the build files any time a "MY_BUILD_*" option is
> toggled.
>
> Ideally, I would like a way to prevent the generation of the build files until
> the second configure completes. Is there a way for me to accomplish this?
>
If you use the project command in each sub project cmake 2.6 will do the
right thing and create sub-solutions that include all targets that they
use in the larger project.
-Bill
More information about the CMake
mailing list