diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-01-08 12:30:57 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-01-08 12:35:24 +0100 |
commit | ad16478a76815f8f61d454bf7760aaf9ffbb4b51 (patch) | |
tree | eefdd9219cc9d59b62e042f49fc7555b980cb7a4 /src/corelib/Qt5CoreConfigExtras.cmake.in | |
parent | 80a741f3616290897ba0d9f1cbd3c9c5ee62da37 (diff) | |
parent | 09c92863001790a0304a5ef389901ee2b5b6cdc2 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi
Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
Diffstat (limited to 'src/corelib/Qt5CoreConfigExtras.cmake.in')
-rw-r--r-- | src/corelib/Qt5CoreConfigExtras.cmake.in | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 8242682a89..a5ed8b2ea3 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -70,7 +70,14 @@ set(_qt5_corelib_extra_includes) # Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module # macro to add it. set(Qt5_POSITION_INDEPENDENT_CODE True) -set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIC\") + +# On x86 and x86-64 systems with ELF binaries (especially Linux), due to +# a new optimization in GCC 5.x in combination with a recent version of +# GNU binutils, compiling Qt applications with -fPIE is no longer +# enough. +# Applications now need to be compiled with the -fPIC option if the Qt option +# \"reduce relocations\" is active. For backward compatibility only, Qt accepts +# the use of -fPIE for GCC 4.x versions. if (CMAKE_VERSION VERSION_LESS 2.8.12 AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)) @@ -79,6 +86,20 @@ else() set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_OPTIONS $$QMAKE_CXXFLAGS_APP) endif() +# Applications using qmake or cmake >= 2.8.12 as their build system will +# adapt automatically. Applications using an older release of cmake in +# combination with GCC 5.x need to change their CMakeLists.txt to add +# Qt5Core_EXECUTABLE_COMPILE_FLAGS to CMAKE_CXX_FLAGS. In particular, +# applications using cmake >= 2.8.9 and < 2.8.11 will continue to build +# with the -fPIE option and invoke the special compatibility mode if using +# GCC 4.x. +set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"\") +if (CMAKE_VERSION VERSION_LESS 2.8.12 + AND (CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" + AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)) + set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIC\") +endif() + !!IF !isEmpty(QT_NAMESPACE) list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE) list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) |