[CMake] multiple out of source builds from same source

William A. Hoffman billlist at nycap.rr.com
Wed Apr 20 16:34:00 EDT 2005


The way that is currently done is via the CMakeCache.txt file.
You can create as many out of source builds as you want.
And each one of them can have different flags and libraries that
it links to.   I frequently have a debug and opt build tree
for my projects.   

-Bill



At 04:20 AM 4/20/2005, cimarron_cmake at taylors.org wrote:

>Hello, 
>
>I have a situation where I want to produce multiple executables
>from the same source code where the different executables would
>differ mostly by linking with different external libraries.
>
>If I was using an ordinary makefile, I'd have a slightly different
>makefile in each of my destination directories, or I would have
>multiple makefiles in my source directory and use make -f to specify
>the specific makefile.
>
>I understand that the CMake way of doing things is to have the
>CMakeLists.txt file reside in the source directory, but then I can't
>effectively have separate setttings in separate CMakeLists.txt files.
>
>So for now I've created what I believe is an unnatural situation 
>where I have a directory structure like:
>
>   source/
>       settings1/
>           CMakeLists.txt  (with settings for build1)
>       settings2/
>           CMakeLists.txt  (with settings for build2)
>   build1
>   build2
>
>and I have my build script cd to build1, do a cmake ../source/settings1
>then cd to build2, do a cmake ../source/settings2, etc.  The problem
>with this is that all my pathnames need an extra level of indirection.
>
>Ideally, I'd like to have something more like
>
>   source/
>       settings1-CMakeLists.txt  (with settings for build1)
>       settings2-CMakeLists.txt  (with settings for build2)
>   build1
>   build2
>
>and then do a cmake -f settings1-CMakeLists.txt ../source in build1
>and cmake -f settings2-CMakeLists.txt ../source in build2 and so on.
>
>So my questions are:
>
>  1. Is there an equivalent to 'make -f' for CMake?
>  2. Is there a better way I can use CMake to accomplish what I want?
>
>I really do want to keep the settings in separate CMake files
>instead of using some kind of conditional processing since I have
>lots of them which are worked on by different people.
>
>Regards,
>
>Cim
>
>
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake 



More information about the CMake mailing list