[CMake] Source code configuration management in CMake?

Tyler Roscoe tyler at cryptio.net
Fri Jan 15 14:17:56 EST 2010


On Fri, Jan 15, 2010 at 05:57:20PM +0000, Ian Scott wrote:
> I have an existing large hierarchically structured code base, but I want 
> to extract a cut-down source code tree that only contains the source 
> code files necessary for a particular project. The files I don't want 
> are scattered through-out the code tree.
> 
> I want to be able to extract this cut-down tree on demand, including 
> modifications to the CMakeLists.txt (and a few other places) to remove 
> references to removed files. I need to do this for a variety of 
> licensing and quality-audit reasons. Just adding some option to my 
> CMakeLists.txt files to exclude files from the compilation will not be 
> enough.

This sounds scary.

I would solve this problem with SCM tools. For example, you could cut a
branch for your pared-down project, delete the unwanted files and modify
the CMakeLists on that branch, and Bob's your uncle. This approach
requires you to use merging to keep your branch up-to-date, but to me
that seems less onerous than having a script that tweaks your build
scripts every time.

tyler


More information about the CMake mailing list