[CMake] multiple out of source builds from same source

Amitha Perera perera at cs.rpi.edu
Wed Apr 20 20:08:59 EDT 2005


On Wed 20 Apr 2005, Dekeyser, Kris wrote:
> I'm very much in favor of your -f suggestion. I think it is a powerfull feature still missing from CMake. Unless somebody is already working on this, I suggest you enter it in the bug tracker.
> 
> For the time being, you can create a cache var "BUILD_TYPE" and have some conditionals like 
> IF(BUILD_TYPE EQUALS 1)
>   # Do your build 1 stuff
> ENDIF(BUILD_TYPE EQUALS 1)
> IF(BUILD_TYPE EQUALS 2)
>   # Do your build 2 stuff
> ENDIF(BUILD_TYPE EQUALS 2)
> in your CMakeLists.txt.

What you wrote above if essentially the same as the -f option, except
it's not actually called -f. Consider the top level CMakeLists.txt:

PROJECT( MyGrandProject )
INCLUDE( ${SETTINGS_FILE} )

Then

   make -f settings1.CMakeLists.txt

becomes

   cmake -DSETTINGS_FILE:STRING=settings1.CMakeLists.txt

Same thing, same flexibility. A little longer, perhaps, but IMO not long
enough to warrant implementing a -f option.

Amitha.


More information about the CMake mailing list