summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-05-28 11:02:48 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-05-28 11:23:31 -0300
commite6071345414a61032c6dac2928703c3f500ae7fb (patch)
treec89fe852197b1bb4d0a7bb49d2397b2065fbd674
parentba2f7e3391bd05d79f861d14bf34ebb0205d78e4 (diff)
downloadshiboken-e6071345414a61032c6dac2928703c3f500ae7fb.tar.gz
shiboken-e6071345414a61032c6dac2928703c3f500ae7fb.tar.xz
shiboken-e6071345414a61032c6dac2928703c3f500ae7fb.zip
Disabled GCC optimization flags by default.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>, Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--CMakeLists.txt25
1 files changed, 13 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b183694b..ab356702 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,21 +12,22 @@ add_definitions(${QT_DEFINITIONS})
option(AVOID_PROTECTED_HACK "Avoid protected hack on generated bindings." FALSE)
option(BUILD_TESTS "Build tests." TRUE)
-if (NOT CMAKE_BUILD_TYPE)
- message("No build type provided. Setting to Debug by default")
- set(CMAKE_BUILD_TYPE "Debug")
-endif()
-
-if (MSVC)
+if(MSVC)
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /w /EHsc- /GS- /GR- /DLIBSHIBOKEN_BUILD -D_SCL_SECURE_NO_WARNINGS")
-else()
- if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
- set(CMAKE_CXX_FLAGS "-Wall -Wno-strict-aliasing -DNDEBUG -O2 -Wl,-O1 -Wl,--hash-style=gnu -fvisibility=hidden")
- else()
- set(CMAKE_CXX_FLAGS "-g -Wall -Wno-strict-aliasing -fvisibility=hidden")
+elseif(CMAKE_HOST_UNIX)
+ option(ENABLE_GCC_OPTIMIZATION "Enable specific GCC flags to optimization library size and performance. Only available on Release Mode" 0)
+ set(CMAKE_CXX_FLAGS "-Wall -fvisibility=hidden")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g")
+ if(ENABLE_GCC_OPTIMIZATION)
+ set(CMAKE_BUILD_TYPE Release)
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -DNDEBUG -Os -Wno-strict-aliasing -Wl,-O1")
+ if(NOT CMAKE_HOST_APPLE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--hash-style=gnu")
+ endif()
endif()
endif()
-if (WIN32 OR AVOID_PROTECTED_HACK)
+
+if(WIN32 OR AVOID_PROTECTED_HACK)
message(STATUS "Avoiding protected hack!")
add_definitions("-DAVOID_PROTECTED_HACK")
else()