C++ 如何在 Windows 上设置 cmake

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26514500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:37:33  来源:igfitidea点击:

How to setup cmake on windows

c++windowsboostvisual-studio-2013cmake

提问by anthony corrado

I'm trying to compile a program that requires Cmake and boost on windows. I installed visual studio 2013 express and I cant get cmake to compile the program.

我正在尝试编译一个需要在 Windows 上使用 Cmake 和 boost 的程序。我安装了visual studio 2013 express,但无法使用cmake来编译程序。

cmake -G "Visual Studio 11 Win64" ..

-- The C compiler identification is unknown
-- The CXX compiler identification is unknow
CMake Error in :
No CMAKE_C_COMPILER could be found.

CMake Error in :
No CMAKE_CXX_COMPILER could be found.

回答by drescherjm

Visual Studio 11 Win64is the wrong generator for Visual Studio 2013. You need to use Visual Studio 12 2013 Win64if you are using cmake-3.x or Visual Studio 12 Win64for cmake-2.8.x. A list of the visual studio generators is here.

Visual Studio 11 Win64是 Visual Studio 2013 的错误生成器。如果您使用 cmake-3.x 或Visual Studio 12 Win64for cmake-2.8.x,则需要使用Visual Studio 12 2013 Win64Visual Studio 生成器的列表在这里