如何告诉 CMake 将构建文件放在哪里? [英] How to tell CMake where to put build files?

查看:28
本文介绍了如何告诉 CMake 将构建文件放在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想告诉 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
  • 目录:CMakeFiles/
  • 文件:生成文件
  • 目录:bin/
  • 文件: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

希望这能更清楚地说明我想要什么.

Hope this will clarify more what I want.

推荐答案

您可以使用未公开的命令行选项 -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屋!

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