From 028401325bc88d5699693c774a6271b6bc49df93 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Fri, 22 Jun 2007 09:54:49 +0000 Subject: fatal error if KDE wants to compile with -fvisibility=hidden but Q_DECL_EXPORT expands to nothing svn path=/trunk/KDE/kdelibs/; revision=678787 --- modules/FindKDE4Internal.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 \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") -- cgit v1.2.1