如何告诉CMake在哪里放建立文件? [英] How to tell CMake where to put build files?
问题描述
我想告诉CMake将文件和文件夹输出到不同的文件夹,而不是当前文件夹。我正在谈论CMake生成的文件如下:
I want to tell CMake to output files and folders to a different folder instead of the current folder. I'm talking about the generated files by CMake below:
- 文件:CMakeCache.txt
- dir:CMakeFiles /
- 档案:Makefile
- dir:bin /
- 档案:cmake_install.cmake
- file: CMakeCache.txt
- dir: CMakeFiles/
- file: Makefile
- dir: bin/
- file: cmake_install.cmake
有没有办法让CMake在另一个文件夹中输出这些文件和文件夹?
我写了一个工具,从项目目录的根目录执行CMake,结果我的项目目录被上面生成的文件和文件夹弄乱了。
Is there a way to let CMake output these files and folders in another folder? I wrote a tool that executes CMake from the root of the project-directory, as a result my project-directory gets messed up with the generated files and folders listed above.
这里是我想要的链接:
http://pastebin.com/cxykCi5M
Here a link what I want: http://pastebin.com/cxykCi5M
希望这将澄清更多我想要的。
Hope this will clarify more what I want.
推荐答案
可以使用未记录的命令行options -B
和 -H
分别指定构建目录和源目录。所以,从你的项目的根,你可以做:
You can use the undocumented command line options -B
and -H
to specify your build directory and source directory respectively. So, from your project's root, you can do:
cmake -Bbuild -H.
(其中build是您的构建目录路径。)
(Where build is your build directory path.)
这篇关于如何告诉CMake在哪里放建立文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!