Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit 2d9e047

Browse files
committed
Update CMakeLists.txt
1 parent 5b55095 commit 2d9e047

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,24 @@ add_library(${PROJECT_NAME} STATIC
3737
)
3838

3939
if(MSVC)
40-
target_compile_options(${PROJECT_NAME} PRIVATE /Ox /Oi-
40+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
41+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox")
42+
add_definitions(-DNDEBUG)
43+
endif()
44+
45+
target_compile_options(${PROJECT_NAME} PRIVATE /Oi-
4146
/wd4244 /wd4723 /wd4146
4247
/wd4116
4348
/wd4305
4449
)
4550
target_link_options(${PROJECT_NAME} PRIVATE /NODEFAULTLIB)
4651
else()
47-
target_compile_options(${PROJECT_NAME} PRIVATE -O2 -ffp-contract=off)
52+
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
53+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
54+
add_definitions(-DNDEBUG)
55+
endif()
56+
57+
target_compile_options(${PROJECT_NAME} PRIVATE -ffp-contract=off)
4858
target_link_options(${PROJECT_NAME} PRIVATE -nostdlib)
4959
endif()
5060

0 commit comments

Comments
 (0)