From f01c38d3e8f905632818a2f921d39ccdd28d77f2 Mon Sep 17 00:00:00 2001 From: Downright <12709502+downrighr@user.noreply.gitee.com> Date: Wed, 26 Mar 2025 18:29:17 +0800 Subject: [PATCH] commit 4 cmakelist and .gitignore --- .gitignore | 3 ++- CMakeLists.txt | 17 +++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index ae0af5b..87cacae 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ doxygen !/testdata/functional/*.out !/testdata/performance/*.out build -.antlr \ No newline at end of file +.antlr +.vscode \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d7ebf33..29f8da6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)