c - VS 2017 + cmake + 忍者 + mingw

标签 c visual-studio build-process mingw

我正在使用 VS 2017 的新“打开文件夹”功能,通过 CmakeSettings.json 自动构建 cmake。

代码是用C11写的,所以我需要用gcc(来自mingw-64)编译。我创建了一个新的 cmake 配置,如下所示:

{
  "name": "GNU-Debug",
  "generator": "Ninja",
  "configurationType": "Debug",
  "inheritEnvironments": [ "msvc_x64_x64" ],
  "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
  "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
  "variables": [
    {
      "name": "CMAKE_MAKE_PROGRAM",
      "value": "C:\\msys64\\mingw64\\bin\\mingw32-make.exe"
    },
    {
      "name": "CMAKE_C_COMPILER",
      "value": "C:\\msys64\\mingw64\\bin\\gcc.exe"
    },
    {
      "name": "CMAKE_CXX_COMPILER",
      "value": "C:\\msys64\\mingw64\\bin\\g++.exe"
    }
  ]
}

输出看起来像这样:

The detected version of Ninja (GNU Make 4.2.1 Built for x86_64-w64-mingw32 Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.) is less than the version of Ninja required by CMake (1.3).

这很奇怪,考虑到检测到的忍者版本应该是一个数字。 VS 的 ninja 和 MinGW ninja 都是最新的 (1.8.2)。

有没有其他方法可以让 MinGW + CMake 在 VS 2017 中工作?

最佳答案

原来我不得不重新启动 VS...一切都按预期进行。

关于c - VS 2017 + cmake + 忍者 + mingw,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48407391/

相关文章:

ruby - 在使用 build.gradle 指定最新版本的 Sass jar checkout 另一个分支后,旧 Git 分支上的构建失败

C 使用odbc将图像插入ms sql数据库

c - 如何确保 C 代码中没有浮点运算(Visual Studio 2013 express + WDK 8.1,WDM 内核驱动程序)?

c - 在 "for"条件中声明的变量的范围是什么?

c++ - 我的 C++ 可执行文件在 Visual Studio 2008 IDE 之外的运行速度比在内部快得多,即使在发行版中也是如此

.net - 被修改的 Visual Studio 线

ant - 在典型的 ant 构建文件中有哪些默认目标?

android - Android 构建过程在哪里存储最终图像文件(闪存到手机设备中)?

c - Windows 中的 stdlib 在哪里实现?

c - DLL 调用时堆/堆栈损坏