views:

135

answers:

1

The projects I work on are organised into root folders (VOBS) as follows:

|--BUILD_FOLDER
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--COMPONENT_A
|--COMPONENT_B

Because they are ClearCase VOBS there is no higher level root folder to place a CMakeLists.txt This setup doesn't seem to fit the CMake pattern...

  • Is this a show-stopper to using CMake?
    • It seems that CMake requires everything to be hierarchical as it descends down from one point. .
  • Is CMake the right tool for non-windows/Linux targets?
    • The projects use custom c compilers and invoke 3rd party tools to generate application files in several formats.
A: 

Your components don't have to be subdirectories of the directory you have the CMakeLists.txt file in. Place it in the folder with same rank as of the components and just use relative paths in your ADD_SUBDIRECTORY command:

ADD_SUBDIRECTORY(../componentA)
ADD_SUBDIRECTORY(../componentB)

That's how i suggest you to arrange your folders

|--BUILD_FOLDER           <-- this directory is created by "make" (???)
| |-- BUILD_SCRIPTS
| |-- SOME_MORE_CODE
|
|--META_FOLDER  <--- place CMakeLists.txt here
|--COMPONENT_A
|--COMPONENT_B

Similar directory layout was used to build OpenJDK 6 (but instead of CMake, a usual make was used those days).

Pavel Shved