2024年10月9日 16:06

This commit is contained in:
许大仙 2024-10-09 08:06:03 +00:00
parent 8795ab908b
commit b5769ff0d8

View File

@ -1255,6 +1255,16 @@ set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
add_definitions(-DNDEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
add_definitions(-DRELWITHDEBINFO)
elseif (CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
add_definitions(-DMINSIZEREL)
endif ()
# 辅助函数,用于递归查找所有源文件
function(collect_sources result dir)
file(GLOB_RECURSE new_sources "${dir}/*.c")
@ -1311,7 +1321,6 @@ foreach (SOURCE ${SOURCES})
endif ()
endif ()
endforeach ()
```
## 6.4 配置 .clang-format 文件