Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the directory to which CMake outputs solution and project files?

Tags:

cmake

I have a build/ directory where I'd like CMake to put the *.sln, *.proj, etc. files it generates when I type cmake CMakeLists.txt. How do I do this?

like image 277
May Oakes Avatar asked Mar 23 '11 00:03

May Oakes


1 Answers

You run cmake in the directory you want to build in with the path from the build directory to the source directory. So say your parent directory is called project and it contains src and build you would:

cd build
cmake ../src

That will put the makefiles and the objects in build while leaving the CMakeLists.txt files in src. The one pitfall is that if there is already a CMakeCache.txt in src then you must delete before running cmake.

like image 166
ltc Avatar answered Oct 04 '22 11:10

ltc