开发者

how to use cmake to generate visual studio at specified build directory

开发者 https://www.devze.com 2023-01-10 22:34 出处:网络
I ha开发者_JAVA技巧ve cmake 2.8.2. and a project with directory like this: In the repository, I have bin directory to store built binary files. I can generate visual studio solution files in bin folde

I ha开发者_JAVA技巧ve cmake 2.8.2. and a project with directory like this: In the repository, I have bin directory to store built binary files. I can generate visual studio solution files in bin folder without any problem with cmake-gui. But I'd like to generate solution file using the command line version of cmake.

I tried cmake -G "Visual Studio 9 2008" .. in bin directory, but solution file is generated in the repository directory.


Under normal circumstances, simply running cmake -G"Visual Studio 9 2008" .. while in your bin directory should work.

However, if there is still a CMakeCache.txt file from earlier "in-source" build, this will not work. Is there a CMakeCache.txt in the .. directory? Is so, remove it and try again...


lets say you have

Repository/CMakeLists.txt
Repository/srcs...

and you create a bin directory in Repository:

cd Repository
mkdir bin
cd bin

then you can do what you want:

cmake -G "Visual Studio 9 2008" ..

and it will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消