使用msi安装cmake

通过cmake的gui使用cmake:
在这里插入图片描述

cmake运行时候报错:

CMake Error at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with 
CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> 
value. Or, use the <min>...<max> syntax to tell CMake that the project 
requires at least <min> but has been updated to work with policies introduced 
by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try 
configuring anyway. Configuring incomplete, errors occurred!

这是因为cmake版本不对造成的,我安装的cmake的版本是4.0,但是Cmakelist中的中的版本写的却是:

cmake_minimum_required (VERSION 2.6)

所以版本错误了,报错了,修改成4.0之后,运行正常

简单使用举例:
先在 “Where is the source code” 选择 json-tutorial/tutorial01,源码绝对路径,再在 “Where to build the binary” 键入上一个目录加上 /build,编译文件输出路径

按 Configure,选择编译器,然后按 Generate 便会生成 Visual Studio 的 .sln 和 .vcproj 等文件。注意这个 build 目录都是生成的文件,可以随时删除,也不用上传至仓库。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐