This breaks with e.g. -Wa,-O2. --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,6 @@ message(STATUS "Debug mode ON" ) else(DEBUG STREQUAL "ON") # Release mode set(CMAKE_BUILD_TYPE Release) -set(OPTIMIZE "3" CACHE STRING "Set optimization level (0-3 or DEFAULT)") -if (NOT OPTIMIZE STREQUAL "DEFAULT") - string(REGEX REPLACE "(-O[A-Za-z0-9]+)" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - string(REGEX REPLACE "(-O[A-Za-z0-9]+)" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O${OPTIMIZE}") -endif() message(STATUS "Debug mode OFF") message(STATUS "Optimization level ${OPTIMIZE}")