[CMake] multiple out of source builds from same source
cimarron_cmake at taylors.org
cimarron_cmake at taylors.org
Wed Apr 20 04:20:11 EDT 2005
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
More information about the CMake
mailing list