[CMake] Out of Source CMakeLists

Gonzalo Garramuno ggarra13 at gmail.com
Tue Jan 20 15:00:23 EST 2015


On 20/01/15 15:57, Ma O-Nigiri wrote:
>
> Is this possible? I tried fiddling with some of the path variables and 
> it didn't pan out.
I believe what you want is not possible.  However, you can have:

cmake/modules
         FindOpenEXR.cmake
mytool
     CMakeLists.txt  ( with add_subdirectory( src ) )
     src/
         CMakeLists.txt (with compilation directives )
         file.cpp

To compile, you create a build directory, like:
     $ cd (root of project)
     $ mkdir build-linux64
     $ cd build-linux64
     $ cmake ..
     $ make && make install

This keeps all the files that cmake creates out of your source tree.


More information about the CMake mailing list