aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-05-28 10:54:45 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:04 -0300
commit2ec60aeab9c503325b39fa9a7d162ff80590bb96 (patch)
tree92ae7b367e6ccaed1791f9b7063f85180a2b54c3 /CMakeLists.txt
parentcd72613d2c371c839628a4fad03863daf8b9ed25 (diff)
Disabled GCC optimization flags by default.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>, Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 21 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0fc976a2..e9d6fcd3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,15 +9,29 @@ find_package(LibXslt 1.1.19 REQUIRED)
option(BUILD_TESTS "Build tests." TRUE)
-if (MSVC)
+if(MSVC)
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /w /EHsc- /GS- /GR- /DAPIEXTRACTOR_BUILD -D_SCL_SECURE_NO_WARNINGS")
-else (MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fvisibility=hidden")
- if (NOT CMAKE_HOST_APPLE)
+elseif(CMAKE_HOST_UNIX)
+ option(ENABLE_GCC_OPTIMIZATION "Enable specific GCC flags to optimize 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()
+ if(NOT CMAKE_HOST_APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/symbols.filter")
- endif ()
-endif (MSVC)
-if (BUILD_TESTS)
+ endif()
+endif()
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
+endif()
+
+if(BUILD_TESTS)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/tests)
endif ()