From 62dd2f94a5a9c6f1d1f27b0e7d3ba27eeecac5bd Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Fri, 17 Nov 2017 22:53:58 -0800 Subject: [PATCH] When building with tests, turn off optimiations Debugging failing tests is awful when optimizations are turned on. Signed-off-by: Rick Altherr Signed-off-by: Tim 'mithro' Ansell --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36bea5b9..3fd4665c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.0) project(prjxray) option(PRJXRAY_BUILD_TESTING "" ON) -set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror ${CMAKE_CXX_FLAGS} -O3" ) +set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Werror ${CMAKE_CXX_FLAGS}" ) # Hack for missing option in cctz option(BUILD_TESTING "" OFF) @@ -11,6 +11,9 @@ option(BUILD_TESTING "" OFF) if(PRJXRAY_BUILD_TESTING) enable_testing() + add_compile_options(-O0 -g) +else() + add_compile_options(-O3) endif() add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)