################################################################################## Setup compiler flags to enable or disable optimization# By default: Release with -O3, Debug -O0################################################################################## make sure a build type is set, default to releaseif(NOT CMAKE_BUILD_TYPE)set(CMAKE_BUILD_TYPE Release)endif()message("-- Using Build Type: "${CMAKE_BUILD_TYPE})# Enable optimizations in release buildsif(CMAKE_BUILD_TYPE STREQUAL "Release")# Link time optimizationset(CMAKE_CXX_FLAGS "-Wall -Wextra")# -O2 is often seen as 'the most speed',# but inlining functions and SIMD/Vectorization is# only enabled by -O3, thus it's way faster in some# array calculations.set(CMAKE_CXX_FLAGS_RELEASE "-O3")set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)else()set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")endif()