一、编写测试代码:创建mian.c文件输入以下代码
#include <stdio.h>
int main() {
printf("Use cmake build project.\r\n");
return 0;
}
二、创建CMakeLists.txt文件编写如下内容
cmake_minimum_required(VERSION 3.0)
project(pwx C)
add_executable(pwx main.c)
三、构建代码
cmake -DCMAKE_BUILD_TYPE=Release .
cmake --build ./ --target fillp_client
执行完成后会在当前目录下生成pwx文件,使用./pwx运行即可。