cmake_minimum_required(VERSION 3.28)
get_filename_component(ProjectId {CMAKE_CURRENT_SOURCE_DIR} NAME)
string(REPLACE " " "_" ProjectId{ProjectId})
project({ProjectId} C)
set(CMAKE_C_STANDARD 11)
include_directories("include") # 将自己写的头文件添加到工程的头文件搜索路径中
file(GLOB files "{CMAKE_CURRENT_SOURCE_DIR}/*.c")
foreach (file {files})
get_filename_component(name{file} NAME)
add_executable({name}{file})
target_compile_definitions(${name} PUBLIC DEBUG)
endforeach ()
暂无评论