[CMake] Compiling all .o files in one directory
Brantner Matthias
brantner at m-brantner.de
Wed Jan 23 03:51:46 EST 2008
Hello,
the source files of our C++ project are distributed among many
directories being on different levels.
Each directory contains a CMakeLists.txt file that defines a variable
which contains all .cpp files
from this directory. In order to collect all .cpp files from all
directories, we include each
CMakeLists.txt file in its parent directory and prefix the path of
each file with its directory name.
On the top-level (i.e. our src directory), we create a library
consisting of all compiled .cpp files.
The approach mentioned above is described in "Mastering CMake" (see
Sec. 5.1 on Page 61).
Most of the time, our programmers work on a single file or on multiple
files in one directory and use
the CMake Makefile generator.
I already found out that when changing into the build/src directory, I
can compile/preprocess/ar single
files using "make path/file.o/.i/.s".
My question is, whether there is a way or you have an idea how to
build all object files in one directory
(instead of the complete library) with one command, for example using
"make path". This would be a really
helpful shortcut.
Thank you very much in advance.
Best regards,
Matthias Brantner
More information about the CMake
mailing list