`-H.`选项对CMake意味着什么? [英] What does the `-H.` option means for CMake?

查看:2625
本文介绍了`-H.`选项对CMake意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此回答对CMake的前一个问题显示此命令行:

This answer to a former question on CMake shows this command line:

cmake -H. -Bbuild -G "MSYS Makefiles"

-H什么任务。 选项在这里执行? cmake --help 表示 -H 打印帮助...

What task does the -H. option perform here? cmake --help says that -H prints the help...

我使用CMake 3.2.3。

I am using CMake 3.2.3.

推荐答案

如链接答案中提到的,它是一个未记录的选项,但是查看源代码显示其效果:

As mentioned in the linked answer, it is an undocumented option, but looking at the source code reveals its effect:

cmake :: SetArgs()

if(arg.find("-H",0) == 0)
  {    
  directoriesSet = true;
  std::string path = arg.substr(2);
  path = cmSystemTools::CollapseFullPath(path);
  cmSystemTools::ConvertToUnixSlashes(path);
  this->SetHomeDirectory(path);

最后调用 SetHomeDirectory 源目录。 -B 选项(也未记录)会设置二进制目录。

The last call, SetHomeDirectory actually sets the source directory for the project. The -B option (also undocumented) in turn sets the binary directory.

如果未设置这些选项,二进制目录将是执行cmake的当前文件夹,源目录可以作为位置参数(如果未找到,则源文件夹也将是当前工作目录)。

If these options are not set, the binary directory will be the current folder where cmake is executed, and the source directory can be given as a positional argument (if not found, the source folder will also be the current working directory).

这篇关于`-H.`选项对CMake意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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