项目结构:

$./project
├── src
├── └── main.c
├── CMakeLists.txt
├── *clean_rebuild_and_run.sh
└── README.md

CMakeLists.txt

project(ppdi)     # 改成项目名字
add_executable(${CMAKE_PROJECT_NAME} src/main.c)

clean_rebuild_and_run.sh

rm -rf ./build
mkdir build
cd build
cmake ..
make
echo "Build completed, binary files wrote to ./build/*"
echo ""
echo "hit ENTER to RUN, or Ctrl-C to EXIT..."
read
find . -maxdepth 1 -perm 775 -type f -exec {} \;
最后修改:2021 年 10 月 22 日 07 : 15 PM
如果觉得这篇文章对你有用,请随意赞赏~