From c26c332ac1b79311e0afc242d405dbb444520672 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 22 Jan 2007 17:58:11 +0000 Subject: Undo my accidental change of the compiler flags from the other day. So, re-add the KDE 3.5.x test to check if g++ is fixed WRT to -fvisibility-inlines-hidden and enable it if it works (works fine on 32-bit). As for the C compiler flag, I've moved it to an independent variable. KDE is not in the business of creating C libraries, so I'll add this flag for kde4_add_library & family. If we need a 3rd-party library to be build, a different macro than kde4_add_library will be needed. svn path=/trunk/KDE/kdelibs/; revision=626277 --- modules/FindKDE4Internal.cmake | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/FindKDE4Internal.cmake b/modules/FindKDE4Internal.cmake index 82abcd1f..a1ad01b9 100644 --- a/modules/FindKDE4Internal.cmake +++ b/modules/FindKDE4Internal.cmake @@ -228,6 +228,7 @@ endif(NOT PERL_FOUND) include (MacroLibrary) include (CheckCXXCompilerFlag) +include (CheckCXXSourceCompiles) #add some KDE specific stuff @@ -733,8 +734,24 @@ if (CMAKE_COMPILER_IS_GNUCXX) 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) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") + set (KDE4_C_FLAGS "-fvisibility=hidden") + + macro_push_required_vars() + set (CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} -shared -fPIC -O0 -fvisibility-inlines-hidden") + check_cxx_source_compiles("/* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */ + #include + int some_function( void ) __attribute__ ((visibility(\"default\"))); + int some_function( void ) + { + std::string s(\"blafasel\"); + return 0; + }" GCC_VISIBILITY_INLINES_HIDDEN_BUG) + macro_pop_required_vars() + + if (NOT GCC_VISIBILITY_INLINES_HIDDEN_BUG) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") + endif (NOT GCC_VISIBILITY_INLINES_HIDDEN_BUG) else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR) 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) -- cgit v1.2.1