在D盘创建目录 D:\backup\cmake\t1
创建 main.cpp
#include <stdio.h> int main() { printf("hello man"); return 0; }
创建CMakeLists.txt文件 , 内容如下
project(untitled2) set(CMAKE_CXX_STANDARD 14) add_executable(untitled2 main.cpp)
打开cmd 准备生成Makefile 输入命令: cmake -G "MinGW Makefiles" .
.为当前目录, "MinGW Makefiles"为makefile类型,如果编译器为vs的话使用"NMake Makefiles"
出现好像上面描述表示成功.
执行编译 输入命令 mingw32-make 成功后生成 untitled2.exe 运行 untitled2.exe 在cmd运行 untitled2.exe 出现 hello man
来源:oschina
链接:https://my.oschina.net/janson2013/blog/3207790