Windows 上的 CMake -G Ninja 指定 x64 [英] CMake -G Ninja on Windows specify x64
问题描述
我在 Windows 上使用 CMake 和 Ninja 生成器
I am using CMake on Windows with Ninja generator
cmake -G Ninja ..
这使用默认的 Windows x86 工具链.如何使用 Ninja 生成器指定 x64?
This uses the default Windows x86 toolchain. How to specify x64 using the Ninja generator?
PS:我知道如何使用 Visual Studio 生成 x64
PS: I know how to generate x64 with Visual Studio
cmake -G "Visual Studio 12 2013 Win64 ..
推荐答案
在调用Ninja
生成之前,您必须相应地设置编译器环境.如果您在调用的标准安装路径中安装了 Visual Studio 2013:
You have to set the compiler environment accordingly before calling Ninja
generation. If you have Visual Studio 2013 installed at the standard installation path you call:
"C:Program Files (x86)Microsoft Visual Studio 12.0VCvcvarsall.bat" x64
cmake.exe -G "Ninja" ..
<小时>
编辑:感谢@Antwane 的提示:或者只需从 Microsoft Visual Studio 命令提示符 (x64)
运行 CMake 命令.此提示的快捷方式是位于开始"菜单中".
Edit: Thanks for the hint from @Antwane: "Or simply run CMake command from a Microsoft Visual Studio Command Prompt (x64)
. A shortcut to this prompt is located in Start Menu".
命名因 Visual Studio 版本而异:
The naming varies over the Visual Studio versions:
当我查看生成的 CMakeCache.txt
文件时,我看到:
When I then look into the generated CMakeCache.txt
file I see:
...
//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
...
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING= /machine:x64
...
//Path to a program.
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/link.exe
...
这篇关于Windows 上的 CMake -G Ninja 指定 x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!