`-H.` 选项对 CMake 意味着什么? [英] What does the `-H.` option means for 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:
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屋!