Commit 1615b2e29d33df8f8107bfe2260190fc69d6d440

Ryan C. Gordon 2016-01-08T07:32:51

CMake: only set "-O3 -g" defaults if CMAKE_BUILD_TYPE wasn't set at all.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9cf7aab..d9aeb49 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,8 +158,10 @@ endif()
 
 # Default flags, if not set otherwise
 if("$ENV{CFLAGS}" STREQUAL "")
-  if(USE_GCC OR USE_CLANG)
-    set(CMAKE_C_FLAGS "-g -O3")
+  if(CMAKE_BUILD_TYPE STREQUAL "")
+    if(USE_GCC OR USE_CLANG)
+      set(CMAKE_C_FLAGS "-g -O3")
+    endif()
   endif()
 else()
   set(CMAKE_C_FLAGS "$ENV{CFLAGS}")