commit 4 cmakelist and .gitignore

This commit is contained in:
Downright
2025-03-26 18:29:17 +08:00
parent f74d319399
commit f01c38d3e8
2 changed files with 7 additions and 13 deletions

3
.gitignore vendored
View File

@@ -38,4 +38,5 @@ doxygen
!/testdata/functional/*.out
!/testdata/performance/*.out
build
.antlr
.antlr
.vscode

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required (VERSION 3.19)
# cmake_policy(SET CMP0135 OLD)
@@ -15,18 +15,11 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS OFF)
# ========== 修改点 1强制 Debug 模式(调试时使用) ==========
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type not set, defaulting to Debug mode for GDB support.")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo." FORCE)
endif()
# ========== 修改点 2确保 Debug 模式生成调试信息 ==========
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Debug mode enabled: Adding -g flag for GDB debugging.")
add_compile_options(-g -O0) # -O0 禁用优化,避免干扰调试
endif()
message(STATUS "Build type not set, falling back to Debug mode.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
# Set output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)