Skip to content

Commit 8003319

Browse files
committed
Start with empty CMAKE_CXX_FLAGS and save it to the cache
1 parent 01fe961 commit 8003319

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ string(STRIP "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CMAKE_CXX_FLAGS_RELWITHDEBINFO)
138138
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
139139
CACHE STRING "Flags for RelWithDebInfo configuration." FORCE)
140140

141+
set(CMAKE_CXX_FLAGS "")
141142
if(HNSWLIB_EXAMPLES)
142143
message("Building examples and tests")
143144
message("System architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
@@ -173,7 +174,7 @@ if(HNSWLIB_EXAMPLES)
173174
set(${FLAGS_VAR} "${${FLAGS_VAR}}" CACHE STRING
174175
"Flags for ${config} configuration." FORCE)
175176
endforeach()
176-
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
177+
# string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
177178
endif()
178179
add_cxx_flags(/O2 /W1 /openmp)
179180
endif()
@@ -243,3 +244,8 @@ if(HNSWLIB_EXAMPLES)
243244
endif()
244245
endforeach()
245246
endif()
247+
248+
# Persist CMAKE_CXX_FLAGS in the cache for debuggability.
249+
string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
250+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}"
251+
CACHE STRING "Flags used by the CXX compiler during all build types." FORCE)

0 commit comments

Comments
 (0)