append CMAKE_CXX_FLAGS instead of overwriting it, or else we end up ignoring extra flags asked for by the user
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -9,13 +9,13 @@ endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
if (MSVC)
- set(CMAKE_CXX_FLAGS "/GL /EHsc /W2")
+ set(CMAKE_CXX_FLAGS "/GL /EHsc /W2 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "/Od /Zi")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Oi /Oy /Zc:inline")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Oi /Zi")
set(CMAKE_EXE_LINKER_FLAGS "/LTCG:INCREMENTAL ${CMAKE_EXE_LINKER_FLAGS}")
else()
- set(CMAKE_CXX_FLAGS "-std=c++17 -Wall -march=native -fPIC")
+ set(CMAKE_CXX_FLAGS "-std=c++17 -Wall -march=native -fPIC ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-Werror -g -Og")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")

append CMAKE_CXX_FLAGS instead of overwriting it, or else we end up ignoring extra flags asked for by the user