CMake不生成MinGW makefile,而是生成MSVS 2013

时间:2015-04-24 13:28:33

标签: c++ cmake mingw-w64

我正在尝试使用MinGW安装来构建简单的控制台应用程序:http://nuwen.net/mingw.html。该软件包已包含GCC 4.9.2和Boost 1.57。创建这样的简单文件:

#include <iostream>
#include <boost/accumulators/accumulators.hpp>

using namespace std;

int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

之后我做了以下事情:

> pwd
/d/..../Boost-Accumulators
> mkdir build
> cd build
> pwd
/d/..../Boost-Accumulators/build
> cmake -g "MinGW Makefiles" ..
-- Building for: Visual Studio 12 2013
-- The C compiler identification is MSVC 18.0.31101.0
-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working C compiler using: Visual Studio 12 2013
-- Check for working C compiler using: Visual Studio 12 2013 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 12 2013
-- Check for working CXX compiler using: Visual Studio 12 2013 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/alp/Projects/Boost-Accumulators/build

毕竟我只有这个应用程序大楼的MSVS项目/解决方案(我还有versio 2013安装)。但是我想用MinGW安装来构建它。

如何实现它?

UPD :cmake - G “MinGW Makefiles”.. - 这是正确的命令行。 我在执行时发现了一个注释 - 我的PATH中有sh.exe - MSYS中有一个,Git目录中有一个。它会影响MinGW构建,所以我将其重命名为sh1.exe两者都可以正常工作!

1 个答案:

答案 0 :(得分:0)

  

生成器选项为大写:-G

@Angew