[CMake] Out-of-tree build with multiple executables for eclipse

Azzurite azzurite+cmake at gmail.com
Thu Jan 30 03:22:33 EST 2014


Hello,

I'm very new to CMake.
I'm trying to set up an out-of-source C++ build on Windows with CMake so I
can use version control with eclipse (mingw make). My setup should look
like this:

Root
---> build
---> src
---> test

src/ contains my program code and test/ the unit tests. There is a main
method in src/ and in test/.
I now want the possibility to build all the source files in src/ with Debug
or Release configuration, and a seperate build target for unit tests that
creates another executable with only the unit tests, but should link the
source files from src/ as well.

So far, I've read the articles on the Eclipse CDT4 generator (
http://www.vtk.org/Wiki/Eclipse_CDT4_Generator) and various others I have
found elsewhere.

I can get the build for src/ to work if I run cmake from the build folder:
"cmake ../src". Now I tried to get the second build target (test/) to work,
but I can't get it.

I tried to add a CMakeLists.txt in the Root folder which just defines the
project and add the two directories, but then CMake generates the error
that "The build directory is a subdirectory of the source directory.",
which is not really true, since all the source is in src/ and build/ is a
sibling...

I honestly don't know what to do. Can anyone help me?

Thank you,
Azzu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140130/09f7664f/attachment.html>


More information about the CMake mailing list