From b1a3fa8599e2fc84906cd9877f3efca3ce3238ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 19 Jan 2023 05:28:18 +0100 Subject: [PATCH] Cleanup CMake rules: + Add the option for building with hidden visibility. + Use the result of long files support tests instead of hard-coded definition. + Add the presence test TDEIO::UDS_HIDDEN. + Remove unnecessary tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- CMakeLists.txt | 11 +++++++---- ConfigureChecks.cmake | 23 +++++++++++++++-------- config.h.cmake | 15 ++++++++++----- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 599bc5b..48826da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,12 @@ include( TDESetupPaths ) tde_setup_paths( ) +##### optional stuff + +option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) + + ##### user requested modules #################### option( BUILD_ALL "Build all" OFF ) @@ -59,10 +65,7 @@ include( ConfigureChecks.cmake ) ###### global compiler settings ################# -add_definitions( - -DHAVE_CONFIG_H - -D_LARGEFILE64_SOURCE -) +add_definitions( -DHAVE_CONFIG_H ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 3128330..23277d3 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -29,11 +29,18 @@ if( WITH_GCC_VISIBILITY ) endif( WITH_GCC_VISIBILITY ) -check_type_size( "int" SIZEOF_INT BUILTIN_TYPES_ONLY ) -check_type_size( "long" SIZEOF_LONG BUILTIN_TYPES_ONLY ) - -check_include_file( stdint.h HAVE_STDINT_H ) -check_include_file( systems.h HAVE_SYSTEMS_H ) -check_include_file( linux/inotify.h HAVE_INOTIFY ) - -check_function_exists( statvfs HAVE_STATVFS ) +##### check for TDEIO::UDS_HIDDEN + +tde_save_and_set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} ${TDE_INCLUDE_DIR} ) +tde_save_and_set( CMAKE_REQUIRED_LIBRARIES tdeio-shared ) +check_cxx_source_compiles( " + #include + + int main() + { + int val = TDEIO::UDS_HIDDEN; + return 1; + }" + HAVE_UDS_HIDDEN +) +tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES ) diff --git a/config.h.cmake b/config.h.cmake index d81a482..3dd54e5 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,5 +1,10 @@ -#cmakedefine SIZEOF_INT @SIZEOF_INT@ -#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ -#cmakedefine HAVE_STDINT_H 1 -#cmakedefine HAVE_SYSTEMS_H 1 -#cmakedefine HAVE_STATVFS 1 \ No newline at end of file +#define VERSION "@VERSION@" + +// Defined if you have fvisibility and fvisibility-inlines-hidden support. +#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ + +#cmakedefine HAVE_UDS_HIDDEN 1