Housekeeping in CMake rules:

+ Removed detailed DL library detection - the results were not used.
+ Added test whether the DL library contains _dl_sym function.
+ GTK presence test moved to ConfigureChecks.cmake.
+ Added GTHREAD presence test.
+ Used tde_add_library macro.

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

@ -16,6 +16,7 @@ cmake_minimum_required( VERSION 2.8.12 )
project( kgtk )
##### set up cpack ##############################
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
@ -29,6 +30,7 @@ set(KGTK_VERSION_FULL "${KGTK_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${KGTK_VERSION_FULL}")
include(CPack)
##### include essential cmake modules ###########
include( CheckCXXSourceCompiles )
@ -70,9 +72,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings #################
add_definitions(
-DHAVE_CONFIG_H
)
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" )
@ -86,10 +86,12 @@ tde_conditional_add_subdirectory( BUILD_KGTK_TDE kdialogd3 )
tde_conditional_add_subdirectory( BUILD_KGTK_GTK2 gtk2 )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
##### write configure files #####################
configure_file( config.h.cmake config.h @ONLY )
##### install global wrapper scripts ############
install(PROGRAMS ${CMAKE_SOURCE_DIR}/kdialogd-wrapper DESTINATION ${BIN_INSTALL_DIR})

@ -39,30 +39,21 @@ check_include_file( linux/inotify.h HAVE_INOTIFY )
check_function_exists( statvfs HAVE_STATVFS )
check_function_exists( getpeereid HAVE_GETPEEREID )
if ( BUILD_KGTK_GTK2 )
# Check if we have dlvsym...
find_library(LIBDLVSYM_LIBRARY
NAMES dl
PATHS /lib /usr/lib /usr/X11R6/lib /usr/local/lib)
if(LIBDLVSYM_LIBRARY)
set(HAVE_DLVSYM 1)
# Determine version of dlsym...
find_library(LIBDL_LIBRARY
NAMES dl
PATHS /lib /usr/lib /usr/X11R6/lib /usr/local/lib)
if(LIBDL_LIBRARY)
execute_process(COMMAND objdump --dynamic-syms ${LIBDL_LIBRARY}
COMMAND grep dlsym
OUTPUT_VARIABLE DLSYM_DATA)
separate_arguments(DLSYM_DATA)
if (${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 4)
cmake_policy(SET CMP0007 OLD)
endif (${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 4)
list(GET DLSYM_DATA 4 KGTK_DLSYM_VERSION)
endif(LIBDL_LIBRARY)
else(LIBDLVSYM_LIBRARY)
message("** INFORMATION: You're libdl does not contain dlvsym - SWT apps will not be supported")
endif(LIBDLVSYM_LIBRARY)
endif ()
##### check for gtk+ 2.x
if( BUILD_KGTK_GTK2 )
pkg_check_modules( GTK gtk+-2.0>=2.6 )
pkg_check_modules( GTHREAD gthread-2.0 )
if( NOT GTK_FOUND OR NOT GTHREAD_FOUND )
tde_message_fatal( "GTK2 support is requested but not found on your system" )
endif()
check_library_exists( "${CMAKE_DL_LIBS}" _dl_sym "" HAVE_DL_SYM )
if( NOT HAVE_DL_SYM )
tde_message_fatal( "The DL library seems no longer contains _dl_sym function" )
endif()
endif()

@ -1,11 +1,15 @@
// 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@
/* Define to 1 if you have the `getpeereid' function. */
#cmakedefine HAVE_GETPEEREID 1
/* Define if you have the struct ucred */
#cmakedefine HAVE_STRUCT_UCRED 1
#cmakedefine HAVE_DLVSYM 1
#define VERSION "@KGTK_VERSION_FULL@"
#define KGTK_DLSYM_VERSION "@KGTK_DLSYM_VERSION@"

@ -1,22 +1,33 @@
include(FindPkgConfig)
pkg_check_modules(GTK gtk+-2.0>=2.6)
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/common
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${GTK_INCLUDE_DIRS}
)
if (GTK_FOUND)
message("** INFORMATION: Gtk2 LD_PRELOAD library will be built.")
# set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
##### kgtk2 (shared)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR} ${GTK_INCLUDE_DIRS})
set(kgtk2_SRCS kgtk2.c)
add_library(kgtk2 SHARED ${kgtk2_SRCS})
target_link_libraries(kgtk2 ${GTK_LDFLAGS} -lgthread-2.0 -lglib-2.0 -lc -ldl)
tde_add_library( kgtk2 SHARED NO_LIBTOOL_FILE
SOURCES
kgtk2.c
install(TARGETS kgtk2 LIBRARY DESTINATION ${LIB_INSTALL_DIR}/kgtk )
LINK
${GTK_LIBRARIES}
${GTHREAD_LIBRARIES}
${CMAKE_DL_LIBS}
configure_file (kgtk2-wrapper.cmake ${CMAKE_CURRENT_BINARY_DIR}/kgtk2-wrapper @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kgtk2-wrapper DESTINATION bin)
else (GTK_FOUND)
message("** ERROR : Could not locate Gtk2 headers, Gtk2 LD_PRELOAD library will not be built.")
endif (GTK_FOUND)
DESTINATION ${LIB_INSTALL_DIR}/kgtk
)
##### other data
configure_file( kgtk2-wrapper.cmake kgtk2-wrapper @ONLY )
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kgtk2-wrapper
DESTINATION ${BIN_INSTALL_DIR}
)

@ -23,7 +23,6 @@ link_directories(
${TDE_LIBRARY_DIRS}
)
message("** INFORMATION: KDialogD for TDE will be built.")
##### kdialogd3 (executable) #################
@ -37,4 +36,4 @@ tde_add_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS}
LINK tdecore-shared tdeui-shared tdeio-shared
DESTINATION ${BIN_INSTALL_DIR}
)
)

@ -21,19 +21,47 @@ link_directories(
${TQT_LIBRARY_DIRS}
)
message("** INFORMATION: Qt3 LD_PRELOAD library will be built.")
# set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
add_definitions( -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT )
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mangled.h
COMMAND ${CMAKE_SOURCE_DIR}/mangled.sh ${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_BINARY_DIR}/mangled.h)
set(kqt3_SRCS kqt3.cpp mangled.h)
add_definitions(${QT_DEFINITIONS} -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT)
add_library(kqt3 SHARED ${kqt3_SRCS})
target_link_libraries(kqt3 ${TQT_LIBRARIES} -lc -ldl)
install(TARGETS kqt3 LIBRARY DESTINATION ${LIB_INSTALL_DIR}/kgtk)
##### generate mangled.h
configure_file (kqt3-wrapper.cmake ${CMAKE_CURRENT_BINARY_DIR}/kqt3-wrapper @ONLY)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kqt3-wrapper DESTINATION ${BIN_INSTALL_DIR})
add_custom_target(
mangled_header
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/mangled.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mangled.h
COMMAND
${CMAKE_SOURCE_DIR}/mangled.sh
${CMAKE_CXX_COMPILER}
${CMAKE_CURRENT_BINARY_DIR}/mangled.h
)
##### kqt3 (shared)
tde_add_library( kqt3 SHARED NO_LIBTOOL_FILE
SOURCES
kqt3.cpp
LINK
${TQT_LIBRARIES}
${CMAKE_DL_LIBS}
DESTINATION ${LIB_INSTALL_DIR}/kgtk
DEPENDENCIES mangled_header
)
##### other data
configure_file( kqt3-wrapper.cmake kqt3-wrapper @ONLY )
install(
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kqt3-wrapper
DESTINATION ${BIN_INSTALL_DIR}
)

Loading…
Cancel
Save