Clion是写C语言神器,吧啦吧啦......
对于初学者来讲,一个项目,包含多个模块是多么美好的事情,于是就有了这篇博客!
Clion是Cmake项目,因此只需要稍微配置一下CmakeLists.txt就可以实现如下效果
具体配置如下:
根CmakeLists.txt配置
cmake_minimum_required(VERSION 3.25) project(demo C) set(CMAKE_C_STANDARD 11) # 将一个一个的子项目进行配置 add_subdirectory(${PROJECT_SOURCE_DIR}/lesson01) add_subdirectory(${PROJECT_SOURCE_DIR}/lesson02) add_subdirectory(${PROJECT_SOURCE_DIR}/lesson03) add_subdirectory(${PROJECT_SOURCE_DIR}/lesson04)
子路径配置如下
cmake_minimum_required(VERSION 3.25) project(lesson3 C) set(CMAKE_C_STANDARD 11) add_executable(lesson3 main.c)
标签:subdirectory,配置,程序,PROJECT,SOURCE,add,Clion,DIR From: https://www.cnblogs.com/wancker/p/17683986.html