commit 4 cmakelist and .gitignore
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -38,4 +38,5 @@ doxygen
|
||||
!/testdata/functional/*.out
|
||||
!/testdata/performance/*.out
|
||||
build
|
||||
.antlr
|
||||
.antlr
|
||||
.vscode
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user