Hi,

as I just got my second report that phonon doesn't link I thought I'd better 
implement a check that errors out if Qt has been compiled without visibility 
support but KDE is compiled with default hidden visibility.

This is necessary for
1. phonon which uses Q_DECL_EXPORT as export macro
2. all plugins that export their entry symbols using Q_DECL_EXPORT or any 
other macro that uses Q_DECL_EXPORT

Ok, to commit the attached patch?

PS: please CC me on replys

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
[EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]
Index: FindKDE4Internal.cmake
===================================================================
--- FindKDE4Internal.cmake	(revision 677006)
+++ FindKDE4Internal.cmake	(working copy)
@@ -753,7 +753,22 @@
    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 ${_source}")
+      endif(NOT _compile_result)
+      if(_run_result)
+         message(FATAL_ERROR "Qt compiled without support for -fvisibility=hidden")
+      endif(_run_result)
+
       if (GCC_IS_NEWER_THAN_4_2)
           set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
       endif (GCC_IS_NEWER_THAN_4_2)

Attachment: pgp55E3bXBMZz.pgp
Description: PGP signature

_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to