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>
pull/4/head
Slávek Banko 3 years ago
parent cf4061c954
commit 06e9675747
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 ) project( kgtk )
##### set up cpack ############################## ##### set up cpack ##############################
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") 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}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${KGTK_VERSION_FULL}")
include(CPack) include(CPack)
##### include essential cmake modules ########### ##### include essential cmake modules ###########
include( CheckCXXSourceCompiles ) include( CheckCXXSourceCompiles )
@ -70,9 +72,7 @@ include( ConfigureChecks.cmake )
###### global compiler settings ################# ###### global compiler settings #################
add_definitions( add_definitions( -DHAVE_CONFIG_H )
-DHAVE_CONFIG_H
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) 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_KGTK_GTK2 gtk2 )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
##### write configure files ##################### ##### write configure files #####################
configure_file( config.h.cmake config.h @ONLY ) configure_file( config.h.cmake config.h @ONLY )
##### install global wrapper scripts ############ ##### install global wrapper scripts ############
install(PROGRAMS ${CMAKE_SOURCE_DIR}/kdialogd-wrapper DESTINATION ${BIN_INSTALL_DIR}) 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( statvfs HAVE_STATVFS )
check_function_exists( getpeereid HAVE_GETPEEREID ) check_function_exists( getpeereid HAVE_GETPEEREID )
if ( BUILD_KGTK_GTK2 )
# Check if we have dlvsym... ##### check for gtk+ 2.x
find_library(LIBDLVSYM_LIBRARY
NAMES dl if( BUILD_KGTK_GTK2 )
PATHS /lib /usr/lib /usr/X11R6/lib /usr/local/lib)
pkg_check_modules( GTK gtk+-2.0>=2.6 )
if(LIBDLVSYM_LIBRARY) pkg_check_modules( GTHREAD gthread-2.0 )
set(HAVE_DLVSYM 1)
# Determine version of dlsym... if( NOT GTK_FOUND OR NOT GTHREAD_FOUND )
find_library(LIBDL_LIBRARY tde_message_fatal( "GTK2 support is requested but not found on your system" )
NAMES dl endif()
PATHS /lib /usr/lib /usr/X11R6/lib /usr/local/lib)
check_library_exists( "${CMAKE_DL_LIBS}" _dl_sym "" HAVE_DL_SYM )
if(LIBDL_LIBRARY) if( NOT HAVE_DL_SYM )
execute_process(COMMAND objdump --dynamic-syms ${LIBDL_LIBRARY} tde_message_fatal( "The DL library seems no longer contains _dl_sym function" )
COMMAND grep dlsym endif()
OUTPUT_VARIABLE DLSYM_DATA)
separate_arguments(DLSYM_DATA) endif()
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 ()

@ -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. */ /* Define to 1 if you have the `getpeereid' function. */
#cmakedefine HAVE_GETPEEREID 1 #cmakedefine HAVE_GETPEEREID 1
/* Define if you have the struct ucred */ /* Define if you have the struct ucred */
#cmakedefine HAVE_STRUCT_UCRED 1 #cmakedefine HAVE_STRUCT_UCRED 1
#cmakedefine HAVE_DLVSYM 1
#define VERSION "@KGTK_VERSION_FULL@" #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)" ) ##### kgtk2 (shared)
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)
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/common ${CMAKE_BINARY_DIR} ${GTK_INCLUDE_DIRS}) tde_add_library( kgtk2 SHARED NO_LIBTOOL_FILE
set(kgtk2_SRCS kgtk2.c) SOURCES
add_library(kgtk2 SHARED ${kgtk2_SRCS}) kgtk2.c
target_link_libraries(kgtk2 ${GTK_LDFLAGS} -lgthread-2.0 -lglib-2.0 -lc -ldl)
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) DESTINATION ${LIB_INSTALL_DIR}/kgtk
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) ##### 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} ${TDE_LIBRARY_DIRS}
) )
message("** INFORMATION: KDialogD for TDE will be built.")
##### kdialogd3 (executable) ################# ##### kdialogd3 (executable) #################
@ -37,4 +36,4 @@ tde_add_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
LINK tdecore-shared tdeui-shared tdeio-shared LINK tdecore-shared tdeui-shared tdeio-shared
DESTINATION ${BIN_INSTALL_DIR} DESTINATION ${BIN_INSTALL_DIR}
) )

@ -21,19 +21,47 @@ link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
) )
message("** INFORMATION: Qt3 LD_PRELOAD library will be built.")
# set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) add_definitions( -DTQT_THREAD_SUPPORT )
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_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) ##### generate mangled.h
add_definitions(${QT_DEFINITIONS} -DTQT_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)
configure_file (kqt3-wrapper.cmake ${CMAKE_CURRENT_BINARY_DIR}/kqt3-wrapper @ONLY) add_custom_target(
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kqt3-wrapper DESTINATION ${BIN_INSTALL_DIR}) 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