Update tde_setup_gcc_visibility macro

+ In the test include kdemacros.h with detected full path to avoid FTBFS.
+ Do not test gcc visibility on TDE unless the current module uses TDE.
+ Do not test gcc visibility on TQt unless the current module uses TQt.
+ Improve test for gcc visibility on TQt to make it more accurate.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit f8254e1561)
r14.0.x
Slávek Banko 6 years ago
parent 03d0eff00d
commit 3fe0a2fcc3
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1869,37 +1869,41 @@ macro( tde_setup_gcc_visibility )
tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" ) tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" )
endif( NOT UNIX ) endif( NOT UNIX )
find_library( TQT_LIBFILE tqt-mt HINTS "${TQT_LIBRARY_DIRS}" ) if( TQT_FOUND )
if( NOT "${TQT_LIBFILE}" STREQUAL "TQT_LIBFILE-NOTFOUND" ) find_library( TQT_LIBFILE tqt-mt HINTS "${TQT_LIBRARY_DIRS}" )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY" ) if( NOT "${TQT_LIBFILE}" STREQUAL "TQT_LIBFILE-NOTFOUND" )
execute_process( message( STATUS "Performing Test HAVE_TQT_VISIBILITY" )
COMMAND readelf --syms "${TQT_LIBFILE}" execute_process(
OUTPUT_VARIABLE HAVE_TQT_VISIBILITY COMMAND readelf --syms "${TQT_LIBFILE}"
) OUTPUT_VARIABLE HAVE_TQT_VISIBILITY
if( "${HAVE_TQT_VISIBILITY}" STREQUAL "" OR )
"${HAVE_TQT_VISIBILITY}" MATCHES "DEFAULT[^\n]*QSettingsPrivate" ) if( "${HAVE_TQT_VISIBILITY}" STREQUAL "" OR
message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Failed" ) "${HAVE_TQT_VISIBILITY}" MATCHES "GLOBAL[\t ]+DEFAULT[^\n]+QSettingsPrivate" )
tde_message_fatal( "gcc visibility support was requested, but not supported in tqt library" ) message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Failed" )
tde_message_fatal( "gcc visibility support was requested, but not supported in tqt library" )
endif( )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Success" )
endif( ) endif( )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Success" ) endif( TQT_FOUND )
endif( )
if( TDE_FOUND )
find_file( TDEMACROS_H kdemacros.h HINTS "${TDE_INCLUDE_DIR}" ) find_file( TDEMACROS_H kdemacros.h HINTS "${TDE_INCLUDE_DIR}" )
if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" ) if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" ) tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
check_cxx_source_compiles( " check_cxx_source_compiles( "
#include <kdemacros.h> #include <${TDEMACROS_H}>
#ifndef __KDE_HAVE_GCC_VISIBILITY #ifndef __KDE_HAVE_GCC_VISIBILITY
#error gcc visibility is not enabled in tdelibs #error gcc visibility is not enabled in tdelibs
#endif #endif
int main() { return 0; } " int main() { return 0; } "
HAVE_TDE_VISIBILITY HAVE_TDE_VISIBILITY
) )
tde_restore( CMAKE_REQUIRED_INCLUDES ) tde_restore( CMAKE_REQUIRED_INCLUDES )
if( NOT HAVE_TDE_VISIBILITY ) if( NOT HAVE_TDE_VISIBILITY )
tde_message_fatal( "gcc visibility support was requested, but not supported in tdelibs" ) tde_message_fatal( "gcc visibility support was requested, but not supported in tdelibs" )
endif( NOT HAVE_TDE_VISIBILITY ) endif( NOT HAVE_TDE_VISIBILITY )
endif( ) endif( )
endif( TDE_FOUND )
set( __KDE_HAVE_GCC_VISIBILITY 1 ) set( __KDE_HAVE_GCC_VISIBILITY 1 )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")

Loading…
Cancel
Save