[Cmake] Cmake flexibility

Bill Hoffman bill.hoffman at kitware.com
Thu Mar 20 08:55:25 EST 2003


One thing you could do is this:


Source
  Code
    Modules
      Module1
        Test
      Module2
        Test
    Applications
      App1
      App2
  Documentation

In the Source/CMakeLists.txt file:
SUBDIRS(Code/Modules)
SUBDIRS(Code/Modules/Module1/Test)
SUBDIRS(Code/Modules/Module2/Test)

In Modules/CMakeLists.txt file:
SUBDIRS(Module1 Module2)

Then have no SUBDIRS in Module1 or Module2.

So, if you did a make from Source, it would build first the Modules, then Test1, then Test2.    

If you ran make from Modules, it would only build Module1 and Module2 but not the tests.  

If you ran make from Module1/Test or Module2/Test it would build those tests.

-Bill







More information about the CMake mailing list