CMake error: error in configuration process, project files may be invalid 解决办法

  • 环境 window10 + vs2015 + cmake3.10版本以上

  • 报错case1 :

  • 报错case2:

    • Cmake Could NOT find ZLIB (missing ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
    • 解决办法:先编译zlib库,确保生成dll和所需的include文件
      • cmake gui 首先单击CMake的Add Entry按钮,添加对应的ZLIB_LIBRARYZLIB_INCLUDE_DIR变量,重新confugure和generate即可
      • 命令行指定 cmake -D ZLIB_LIBRARY:FILEPATH="C:/path/to/zlib/zlib.lib" - D ZLIB_INCLUDE_DIR:PATH="c:/path/to/zlib/include"
  • Failed to run MSBuild command xxx to get the value of VCTargetsPath:

    • cmake 的gui交互工具 生成vs工程文件时,报以上错误,通过添加MSbuild.exe目录到环境变量以及验证对应的VS版本之外,均无法解决

    • 随后使用cmd 中切换至项目cmakefiles.txt目录,cd build cmake -G “Visual Studio 14 2015” …

      发现cmake 找不到 Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project

    • 下载Windows SDK 8.1最终解决,下载地址为https://developer.microsoft.com/zh-cn/windows/downloads/sdk-archive/

  • No CMAKE_C_COMPILER could be found

    • 虽然Visual Studio IDE成功安装,但未安装任何构建工具,C ++编译器可能未安装成功,导致cmake找不到;可以通过尝试在Visual Studio 2015 GUI中手动创建C ++项目,进一步提示下载所缺的C++插件。Cmake随后能够毫无困难地找到编译器。

    • https://blog.csdn.net/qq_39482438/article/details/81013100


版权声明:本文为qikaihuting原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。