Skip to content

Commit d357f24

Browse files
committed
Additional replacements on CMAKE_CXX_FLAGS
1 parent e65a14e commit d357f24

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function(add_example_or_test TARGET_NAME ...)
8181
endif()
8282
endfunction()
8383

84+
8485
option(HNSWLIB_ENABLE_EXCEPTIONS "Whether to enable exceptions in hnswlib" ON)
8586
if(HNSWLIB_ENABLE_EXCEPTIONS)
8687
message("Exceptions are enabled using HNSWLIB_ENABLE_EXCEPTIONS=ON (default)")
@@ -126,12 +127,16 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
126127
# Turn on assertions in the RelWithDebInfo build type.
127128
string(REPLACE "/D NDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
128129
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
130+
string(REPLACE "/D NDEBUG" "" CMAKE_CXX_FLAGS
131+
"${CMAKE_CXX_FLAGS}")
129132
else()
130133
set(ENABLE_EXCEPTIONS_FLAGS -fexceptions)
131134
set(DISABLE_EXCEPTIONS_FLAGS -fno-exceptions)
132135
# Turn on assertions in the RelWithDebInfo build type.
133136
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO
134137
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
138+
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS
139+
"${CMAKE_CXX_FLAGS}")
135140
endif()
136141
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_NEW}"
137142
CACHE STRING "Flags for RelWithDebInfo configuration." FORCE)
@@ -171,6 +176,7 @@ if(HNSWLIB_EXAMPLES)
171176
set(${FLAGS_VAR} "${${FLAGS_VAR}}" CACHE STRING
172177
"Flags for ${config} configuration." FORCE)
173178
endforeach()
179+
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
174180
endif()
175181
add_cxx_flags(/O2 /W1 /openmp)
176182
endif()

0 commit comments

Comments
 (0)