Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hnwyllmm authored Nov 6, 2024
1 parent 8c68a18 commit 5608a90
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type:Default is debug" FORCE)
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)

# 输出当前构建类型
message(STATUS "Using build type: ${CMAKE_BUILD_TYPE}")
Expand Down Expand Up @@ -54,6 +55,12 @@ ENDIF(WIN32)
# This is for clangd plugin for vscode
# mute sign-compare error in lex/yacc
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -Wall -Werror -Wno-error=sign-compare")
IF ("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "debug")
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -DDEBUG -g -O0")
ELSEIF ("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "release")
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -g -O2")
ENDIF()

IF (ENABLE_NOPIE)
SET(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -no-pie")
ADD_LINK_OPTIONS(-no-pie)
Expand Down Expand Up @@ -160,11 +167,6 @@ ENDIF(WITH_UNIT_TESTS)
SET(CMAKE_CXX_FLAGS ${CMAKE_COMMON_FLAGS})
SET(CMAKE_C_FLAGS ${CMAKE_COMMON_FLAGS})

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -DDEBUG")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os")

MESSAGE(STATUS "CMAKE_CXX_FLAGS is " ${CMAKE_CXX_FLAGS})

# ADD_SUBDIRECTORY(src bin) bin 为目标目录, 可以省略
Expand Down

0 comments on commit 5608a90

Please sign in to comment.