CMakeLists.txt
changeset 7994 706218709157
parent 7960 99d5af6997dd
parent 7944 a94f4ef5ba2b
child 8018 091293bc974f
child 8019 b216953c2617
--- a/CMakeLists.txt	Tue Nov 06 20:28:15 2012 -0500
+++ b/CMakeLists.txt	Wed Nov 07 05:18:06 2012 +0100
@@ -57,7 +57,7 @@
 option(ANDROID "Enable Android build [default: off]" OFF)
 option(NOAUTOUPDATE "Disable OS X Sparkle update checking" OFF)
 option(CROSSAPPLE "Enable OSX when not on OSX [default: off]" OFF)
-
+option(MINIMAL_FLAGS "Respect system flags as much as possible [default: off]" OFF)
 
 #bundle .app setup
 if(APPLE OR CROSSAPPLE)
@@ -157,14 +157,21 @@
     set (CMAKE_BUILD_TYPE ${default_build_type} CACHE STRING "Choose the build type, options are: Debug Release." FORCE)
 endif (CMAKE_BUILD_TYPE)
 
-
-#set default flags values for all projects
-set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
-set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
-set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG ${CMAKE_C_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
-set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
-set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+#set default flags values for all projects (unless MINIMAL_FLAGS is true)
+if(NOT MINIMAL_FLAGS)
+    set(CMAKE_C_FLAGS "-pipe")
+    set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer")
+    set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g -DDEBUG")
+    set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
+    set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+    set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+else()
+    #CMake adds a lot of additional configuration flags, so let's clear them up
+    set(CMAKE_C_FLAGS_RELEASE "")
+    set(CMAKE_C_FLAGS_DEBUG "-Wall -DDEBUG")
+    set(CMAKE_CXX_FLAGS_RELEASE "")
+    set(CMAKE_CXX_FLAGS_DEBUG "-Wall -DDEBUG")
+endif()
 
 #parse additional parameters
 if(FPFLAGS OR GHFLAGS)