aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Fernengel <harry@kdevelop.org>2010-03-03 19:57:51 +0000
committerHarald Fernengel <harry@kdevelop.org>2010-03-03 19:57:51 +0000
commitf6af1a885240f67641b2f10ef9289d845fb1bbac (patch)
treee807d988b3d99d03bd14a72e9b88aa88eb7a27b2
parent84ccffd809dc71de314f21cb747d590d246be3ed (diff)
downloadextra-cmake-modules-f6af1a885240f67641b2f10ef9289d845fb1bbac.tar.gz
extra-cmake-modules-f6af1a885240f67641b2f10ef9289d845fb1bbac.tar.bz2
Change the visibility checking test from try_run to try_compile to make
it work when cross-compiling. svn path=/trunk/KDE/kdelibs/; revision=1098490
-rw-r--r--modules/FindKDE4Internal.cmake15
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake
index a31a81d5..c54cdc24 100644
--- a/modules/FindKDE4Internal.cmake
+++ b/modules/FindKDE4Internal.cmake
@@ -1159,31 +1159,28 @@ if (CMAKE_COMPILER_IS_GNUCXX)
string(REGEX MATCH "(--enable-libstdcxx-allocator=mt)" _GCC_COMPILED_WITH_BAD_ALLOCATOR "${_gcc_alloc_info}")
endif (GCC_IS_NEWER_THAN_4_1)
- if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
+ 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")
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 "#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}")
- try_run(_run_result _compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}" COMPILE_OUTPUT_VARIABLE _compile_output_var)
+ try_compile(_compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}" COMPILE_OUTPUT_VARIABLE _compile_output_var)
- if(NOT _compile_result)
- message(FATAL_ERROR "Could not compile simple test program:\n ${_source}\n${_compile_output_var}")
- endif(NOT _compile_result)
- if(_run_result)
+ if(NOT _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)
+ endif(NOT _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)
else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
set (__KDE_HAVE_GCC_VISIBILITY 0)
- endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
+ endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR AND NOT WIN32)
endif (CMAKE_COMPILER_IS_GNUCXX)