aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2007-06-22 09:54:49 +0000
committerMatthias Kretz <kretz@kde.org>2007-06-22 09:54:49 +0000
commit028401325bc88d5699693c774a6271b6bc49df93 (patch)
tree53727152f690568b9ef0ac69a7e838bd74cebbf3
parent9b9eda78bfdacb9217f020ab84da48c8f09572c5 (diff)
downloadextra-cmake-modules-028401325bc88d5699693c774a6271b6bc49df93.tar.gz
extra-cmake-modules-028401325bc88d5699693c774a6271b6bc49df93.tar.bz2
fatal error if KDE wants to compile with -fvisibility=hidden but Q_DECL_EXPORT expands to nothing
svn path=/trunk/KDE/kdelibs/; revision=678787
-rw-r--r--modules/FindKDE4Internal.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake
index adf9410e..0c845c6d 100644
--- a/modules/FindKDE4Internal.cmake
+++ b/modules/FindKDE4Internal.cmake
@@ -769,6 +769,21 @@ if (CMAKE_COMPILER_IS_GNUCXX)
if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
set (KDE4_C_FLAGS "-fvisibility=hidden")
+ # 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 #ifdef QT_VISIBILITY_AVAILABLE \n return 0;\n #else \n return 1; \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}")
+
+ try_run(_run_result _compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}")
+
+ if(NOT _compile_result)
+ message(FATAL_ERROR "Could not compile simple test program:\n ${_source}")
+ endif(NOT _compile_result)
+ if(_run_result)
+ message(FATAL_ERROR "Qt compiled without support for -fvisibility=hidden. This will break plugins and linking of some applications. Please fix your Qt installation.")
+ endif(_run_result)
if (GCC_IS_NEWER_THAN_4_2)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")