如何更改CMake输出解决方案和项目文件的目录? [英] How do I change the directory to which CMake outputs solution and project files?

查看:1085
本文介绍了如何更改CMake输出解决方案和项目文件的目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个build /目录,我想让CMake把它生成的* .sln,* .proj等文件,当我键入cmake CMakeLists.txt。

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?

推荐答案

在要构建的目录中运行cmake,使用build目录中的路径源目录。所以说你的父目录叫做project,它包含src和build你会:

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

这会将makefile和对象放在构建中,而将CMakeLists.txt文件保留在src 。一个陷阱是,如果在src中已经有一个CMakeCache.txt,那么你必须在运行cmake之前删除。

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.

这篇关于如何更改CMake输出解决方案和项目文件的目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆