Windows上的CMake -G Ninja指定x64 [英] CMake -G Ninja on Windows specify x64

查看:2548
本文介绍了Windows上的CMake -G Ninja指定x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用带有忍者生成器的CMake

I am using CMake on Windows with Ninja generator

cmake -G Ninja ..

这使用默认的Windows x86工具链。
如何使用忍者生成器指定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.0\VC\vcvarsall.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屋!

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