From ecc9eb4df1ae9db04985dd5385d6891bacccad1e Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 27 Jun 2020 19:28:54 +0100 Subject: [PATCH] CMake: Set optimisation flags if no build type specified --- cmake/CompileFlags.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index 50a6757135..ab69f02c37 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -68,6 +68,11 @@ macro(compile_flags) -fno-strict-aliasing ) + if(NOT CMAKE_BUILD_TYPE) + # Sensible default if no build type specified + add_compile_options(-O2 -DNDEBUG) + endif(NOT CMAKE_BUILD_TYPE) + #add_compile_options( # When we are a stable release (Release build + USE_ASSERTS not set), # assertations are off, which trigger a lot of warnings. We disable