[CMake] 'Parallel' CMakeLists.txt?

Brad King brad.king at kitware.com
Tue Jan 31 11:03:36 EST 2012


On 1/31/2012 11:00 AM, Brad King wrote:
> On 1/31/2012 10:55 AM, Nicolas Desprès wrote:
>> All these considerations are important but maybe we could just do
>> first the easy path which is: add a -f option which change the default
>> name every where, for all sub-directories, try_compile, etc...
>
> I'm willing to entertain patches but I really think this is a can of worms.

I still don't understand the use case.  Version control tools can
be used to fork build systems during refactoring.  If your project
permanently wants multiple options then just put this in the top of
each CMakeLists.txt:

   if(MYPROJ_ALTERNATE_CMAKE)
     include(CMakeLists.alt)
     return()
   endif()

Another option is to take advantage of CMake's capability to do
"out-of-source source".  Create a separate source tree that has
only CMakeLists.txt files in it and that has an option to get
its source files from other paths.  You can even add_subdirectory
into another source tree that is not below the current one.

-Brad


More information about the CMake mailing list