aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2013-02-16 10:06:11 +0100
committerAlex Neundorf <neundorf@kde.org>2013-02-16 10:06:11 +0100
commitb3eadc23c94664a8df8519396aa5ed56f3238ef3 (patch)
treec5b0ccea0f428d383c691498da3a9aace9764349
parent9787a60e9c67ce90f19d3abf9be02150640041d8 (diff)
downloadextra-cmake-modules-b3eadc23c94664a8df8519396aa5ed56f3238ef3.tar.gz
extra-cmake-modules-b3eadc23c94664a8df8519396aa5ed56f3238ef3.tar.bz2
KDECompilerSettings: use information from Qt5Config.cmake
Instead of testing for it, we can simply use the information provided by Qt5 config.cmake files Alex
-rw-r--r--kde-modules/KDECompilerSettings.cmake29
1 files changed, 6 insertions, 23 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index 5d973a58..2311d30f 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -374,35 +374,18 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
-
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
-
# TODO: this variable is not documented and not used anywhere
# added by Thiago here http://quickgit.kde.org/index.php?p=kdelibs.git&a=commitdiff&h=6bb4ef06259281d643d410cc4e84cd40bf4cd43f
# and moved by Thiago into this extra variable here: http://quickgit.kde.org/index.php?p=kdelibs.git&a=commitdiff&h=a47300bd88435735bca6518926bc6c0e4c6cd708
# set (KDE4_C_FLAGS "-fvisibility=hidden")
-# TODO: get the following information from QtConfig.cmake
-
-# # check that Qt defines Q_DECL_EXPORT as __attribute__ ((visibility("default")))
-# # if it doesn't and KDE compiles with hidden default visibiltiy plugins will break
- set(_source "#include <QtCore/QtGlobal>\n int main()\n {\n #ifndef QT_VISIBILITY_AVAILABLE \n #error QT_VISIBILITY_AVAILABLE is not available\n #endif \n }\n")
- set(_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/check_qt_visibility.cpp)
- file(WRITE "${_source_file}" "${_source}")
- set(_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${QT_INCLUDES}")
-
- set (CMAKE_CXX_FLAGS_SAVED "${CMAKE_CXX_FLAGS}")
- # If Qt is built with reduce-relocations (The default) we need to add -fPIE here.
- set (CMAKE_CXX_FLAGS "${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
-
- try_compile(_compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}" COMPILE_OUTPUT_VARIABLE _compile_output_var)
-
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVED}")
+ if (TARGET Qt5::Core)
+ if(NOT QT_VISIBILITY_AVAILABLE)
+ message(FATAL_ERROR "Qt compiled without support for -fvisibility=hidden. This will break plugins and linking of some applications. Please fix your Qt installation (try passing --reduce-exports to configure).")
+ endif()
+ endif()
- if(NOT _compile_result)
- message(STATUS "${_compile_output_var}")
- message(STATUS "Qt compiled without support for -fvisibility=hidden. This will break plugins and linking of some applications. Please fix your Qt installation (try passing --reduce-exports to configure).")
- endif(NOT _compile_result)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
if (GCC_IS_NEWER_THAN_4_2)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")