summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2012-04-04 17:36:37 -0300
committerAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2012-04-04 17:36:37 -0300
commitf87b7484d122f5f6cd027267fd5707d03758078a (patch)
tree794641d766e4f5fa209da140c46a55c870955729 /CMakeLists.txt
parent7e993408ddaf5ead064f86a5cfe59f1be3a93329 (diff)
Properly build against Qt 5 alpha.
Qt 5 alpha release has some build issues that should be addressed in order to build tp-qt against it: - When running configure in Qt 5 alpha, the pkgconfig files are properly generated, but when make is executed, the files are replaced with empty ones, so to build tp-qt one must either backup the pkgconfig files generated during the configure phase before running make and replace them afterwards, or re-run configure with the same parameters after building it. (reported and should be fixed when beta is out) - If Qt 5 alpha is built with -reduce-relocations enabled, one must add the keyword "reduce_relocations" to qtbase/lib/pkgconfig/QtCore.pc in the qt_config section, so that tp-qt knows when to use -fPIC/PIE accordingly. (reported and should be fixed when beta is out)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b6bb854..b61c12f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,13 @@ set(QT5_MIN_VERSION "5.0.0")
set(QT5_MAX_VERSION "6.0.0")
find_package(Qt REQUIRED)
+foreach(flag ${QT_CONFIG_FLAGS})
+ if (${flag} MATCHES "reduce_relocations")
+ set(TP_QT_EXECUTABLE_LINKER_FLAGS "-fPIE")
+ set(TP_QT_LIBRARY_LINKER_FLAGS "-fPIC")
+ endif (${flag} MATCHES "reduce_relocations")
+endforeach(flag ${QT_CONFIG_FLAGS})
+
# This value contains the library's SOVERSION. This value is to be increased everytime an API/ABI break
# occurs, and will be used for the SOVERSION of the generated shared libraries.
if (${QT_VERSION_MAJOR} EQUAL 4)
@@ -124,7 +131,9 @@ endif (ENABLE_DEBUG_OUTPUT)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
set(CMAKE_REQUIRED_DEFINITIONS "")
-set(CMAKE_REQUIRED_FLAGS "")
+# set the flags (-fPIE) here so that CHECK_CXX_SOURCE_COMPILES works properly if qt5 was built with
+# -reduce-locations
+set(CMAKE_REQUIRED_FLAGS "${TP_QT_EXECUTABLE_LINKER_FLAGS}")
CHECK_CXX_SOURCE_COMPILES("
#include <QtCore/QtGlobal>
@@ -141,6 +150,9 @@ macro_log_feature(QT_GLIB_SUPPORT "Qt Glib Support"
"http://qt.nokia.com/" FALSE ""
"Needed, together with Telepathy-Glib, to build most of the unit tests")
+# reset flags
+set(CMAKE_REQUIRED_FLAGS "")
+
# Find python version >= 2.5
find_package(PythonLibrary REQUIRED)
set(REQUIRED_PY 2.5)