[CMake] Source code configuration management in CMake?

Ian Scott ian.m.scott at student.manchester.ac.uk
Fri Jan 15 12:57:20 EST 2010


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.

Obviously I can do this manually, or write a perl script to do it. But I 
was hoping there was some smart way to do this file filtering with CMake 
- Any ideas?


Many thanks,
Ian Scott.



Example: I currently have:

ROOT--libA--a_blah.cxx
  |     |----a_foo.cxx
  |     |----CMakeLists.txt
  |
  |----libB--b_wibble.cxx
  |     |----b_bar.cxx
  |     |----CMakeLists.txt
  |     |----tools--super_duper_tool.cxx
  |            |----CMakeLists.txt
  |----etc
  |
  |----gui---gui.cxx
  |     |----CMakeLists.txt

I want to be able to produce on demand:
RESTRICTED_ROOT
  |----libA--a_blah.cxx
  |     |----CMakeLists.txt
  |
  |----libB--b_wibble.cxx
  |     |----CMakeLists.txt
  |
  |----gui---gui.cxx
        |----CMakeLists.txt


More information about the CMake mailing list