generic: mostly build system cleanups

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2015-10-29 17:52:26 +02:00
parent a0dbbaabdf
commit 26a1b35e6c
7 changed files with 107 additions and 103 deletions

View file

@ -223,10 +223,6 @@ configure_file(config-compiler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-compil
configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h) configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h)
configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h) configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h)
# these two calls here should go somewhere else, Alex
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
################# list the subdirectories ################# ################# list the subdirectories #################
add_subdirectory( cmake ) add_subdirectory( cmake )

View file

@ -80,11 +80,7 @@ check_symbol_exists(posix_madvise "sys/mman.h" HAVE_MADVISE)
check_symbol_exists(getgrouplist "unistd.h;grp.h" HAVE_GETGROUPLIST)# kdecore/fakes.c check_symbol_exists(getgrouplist "unistd.h;grp.h" HAVE_GETGROUPLIST)# kdecore/fakes.c
check_function_exists(backtrace HAVE_BACKTRACE) # kdecore, kio check_function_exists(backtrace HAVE_BACKTRACE) # kdecore, kio
# This is broken on OSX 10.6 (succeeds but shouldn't do) and doesn't exist check_function_exists(fdatasync HAVE_FDATASYNC) # kdecore, kate
# on previous versions so don't do the check on APPLE.
if(NOT APPLE)
check_function_exists(fdatasync HAVE_FDATASYNC) # kdecore, kate
endif(NOT APPLE)
check_function_exists(mmap HAVE_MMAP) # kdecore, khtml check_function_exists(mmap HAVE_MMAP) # kdecore, khtml
check_function_exists(sendfile HAVE_SENDFILE) # kioslave check_function_exists(sendfile HAVE_SENDFILE) # kioslave
@ -104,6 +100,9 @@ if (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY)
set(HAVE_RESOLV_LIBRARY TRUE) set(HAVE_RESOLV_LIBRARY TRUE)
endif (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY) endif (HAVE___RES_INIT_IN_RESOLV_LIBRARY OR HAVE_RES_INIT_IN_RESOLV_LIBRARY)
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
if (UNIX) if (UNIX)
# for kdecore (kpty) & kdesu # for kdecore (kpty) & kdesu

View file

@ -593,9 +593,6 @@ if(WIN32 OR CYGWIN OR APPLE)
message(FATAL_ERROR "Windows/Cygwin/Apple is NOT supported.") message(FATAL_ERROR "Windows/Cygwin/Apple is NOT supported.")
endif() endif()
# setup default RPATH/install_name handling, it sets up to build with full
# RPATH. When installing, RPATH will be changed to the LIB_INSTALL_DIR
# and all link directories which are not inside the current build dir.
set(_KDE4_PLATFORM_INCLUDE_DIRS) set(_KDE4_PLATFORM_INCLUDE_DIRS)
# add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of the # add our LIB_INSTALL_DIR to the RPATH (but only when it is not one of the
@ -612,6 +609,8 @@ if("${_isSystemPlatformLibDir}" STREQUAL "-1"
set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}") set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
endif() endif()
# add our LIB_INSTALL_DIR to the RPATH, also skip re-linking during install
set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}")
set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -848,7 +847,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(KDE4_CXX_FPIE_FLAGS "-fPIE") set(KDE4_CXX_FPIE_FLAGS "-fPIE")
set(KDE4_PIE_LDFLAGS "-pie") set(KDE4_PIE_LDFLAGS "-pie")
if (CMAKE_SYSTEM_NAME STREQUAL GNU) if(CMAKE_SYSTEM_NAME STREQUAL GNU)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pthread") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pthread")
endif (CMAKE_SYSTEM_NAME STREQUAL GNU) endif (CMAKE_SYSTEM_NAME STREQUAL GNU)
@ -947,8 +946,8 @@ if(NOT KDE4Internal_FIND_QUIETLY)
kde4_print_results() kde4_print_results()
endif() endif()
#add the found Qt and KDE include directories to the current include path # add the found Qt and KDE include directories to the current include path
#the ${KDE4_INCLUDE_DIR}/KDE directory is for forwarding includes, eg. #include <KMainWindow> # the ${KDE4_INCLUDE_DIR}/KDE directory is for forwarding includes, eg. #include <KMainWindow>
set(KDE4_INCLUDES set(KDE4_INCLUDES
${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}
${KDE4_INCLUDE_DIR}/KDE ${KDE4_INCLUDE_DIR}/KDE

View file

@ -11,13 +11,10 @@ include_directories(
) )
macro_optional_find_package(MusicBrainz5) macro_optional_find_package(MusicBrainz5)
macro_log_feature(MUSICBRAINZ5_FOUND set_package_properties(MusicBrainz5 PROPERTIES
"MusicBrainz5" DESCRIPTION "A library that provides access to metadata lookup on the MusicBrainz server"
"A library that provides access to metadata lookup on the MusicBrainz server" URL "http://www.musicbrainz.org"
"http://www.musicbrainz.org" PURPOSE "Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz"
FALSE
""
"Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz"
) )
if(MUSICBRAINZ5_FOUND) if(MUSICBRAINZ5_FOUND)

View file

@ -24,29 +24,27 @@
PROJECT(libkexiv2) PROJECT(libkexiv2)
FIND_PACKAGE(KDE4Internal REQUIRED 4.14.3) ADD_DEFINITIONS(
${QT_DEFINITIONS}
INCLUDE(KDE4Defaults) ${QT_QTDBUS_DEFINITIONS}
INCLUDE(MacroLibrary) ${KDE4_DEFINITIONS}
INCLUDE(MacroOptionalAddSubdirectory) -DKDE_DEFAULT_DEBUG_AREA=51003
INCLUDE(MacroOptionalFindPackage) )
INCLUDE(FindPackageHandleStandardArgs) INCLUDE_DIRECTORIES(
${QDBUS_INCLUDE_DIRS}
ADD_DEFINITIONS (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
INCLUDE_DIRECTORIES (${QDBUS_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${KDE4_INCLUDES} ${KDE4_INCLUDES}
${KDE4_KDECORE_INCLUDES} ${KDE4_KDECORE_INCLUDES}
${KDE4_KDEUI_INCLUDES}) ${KDE4_KDEUI_INCLUDES}
)
SET(LIBKEXIV2_AREA_CODE_GENERAL 51003) FIND_PACKAGE(Exiv2 REQUIRED VERSION "0.21")
ADD_DEFINITIONS(-DKDE_DEFAULT_DEBUG_AREA=${LIBKEXIV2_AREA_CODE_GENERAL}) SET_PACKAGE_PROPERTIES(Exiv2 PROPERTIES
DESCRIPTION "Image metadata library and tools"
SET(EXIV2_MIN_VERSION "0.21") URL "http://www.exiv2.org"
FIND_PACKAGE(Exiv2) PURPOSE "Required to build libkexiv2"
MACRO_LOG_FEATURE(EXIV2_FOUND "Exiv2" "Required to build libkexiv2." "http://www.exiv2.org" )
TRUE ${EXIV2_MIN_VERSION} "")
# ======================================================= # =======================================================
# Set env. variables accordinly. # Set env. variables accordinly.
@ -57,14 +55,18 @@ SET(KEXIV2_LIB_SO_VERSION_STRING "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KD
# ======================================================= # =======================================================
IF(EXIV2_FOUND) ADD_SUBDIRECTORY(libkexiv2)
ADD_SUBDIRECTORY(libkexiv2)
if(ENABLE_TESTING) if(ENABLE_TESTING)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libkexiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.pc) CONFIGURE_FILE(
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) ${CMAKE_CURRENT_SOURCE_DIR}/libkexiv2.pc.cmake
ENDIF(EXIV2_FOUND) ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.pc
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
)

View file

@ -127,10 +127,14 @@ set(solid_LIB_SRCS
backends/shared/cpufeatures.cpp backends/shared/cpufeatures.cpp
) )
macro_optional_find_package( HUpnp ) macro_optional_find_package( HUpnp VERSION "0.9")
set_package_properties(HUpnp PROPERTIES
URL "http://www.herqq.org"
PURPOSE "Allows Solid to provide information about UPnP devices on the network"
TYPE OPTIONAL
)
set(HUPNP_ENABLED FALSE CACHE BOOL "explicitly enable the compilation of the hupnp backend") if(HUPNP_FOUND)
if (HUPNP_ENABLED AND HUPNP_FOUND AND ((HUPNP_VERSION_MAJOR EQUAL 0 AND HUPNP_VERSION_MINOR EQUAL 9) OR (HUPNP_VERSION_MAJOR EQUAL 1)))
include_directories( ${HUPNP_INCLUDE_DIR} ) include_directories( ${HUPNP_INCLUDE_DIR} )
message(STATUS "Building Solid UPnP backend." ) message(STATUS "Building Solid UPnP backend." )
set(solid_LIB_SRCS ${solid_LIB_SRCS} set(solid_LIB_SRCS ${solid_LIB_SRCS}
@ -141,13 +145,8 @@ if (HUPNP_ENABLED AND HUPNP_FOUND AND ((HUPNP_VERSION_MAJOR EQUAL 0 AND HUPNP_VE
backends/upnp/upnpinternetgateway.cpp backends/upnp/upnpinternetgateway.cpp
backends/upnp/upnpcontrolpoint.cpp backends/upnp/upnpcontrolpoint.cpp
) )
else () endif()
if(NOT HUPNP_ENABLED)
message(STATUS "To have UPnP support, explicitly enable HUPNP_ENABLED in the cmake cache")
endif(NOT HUPNP_ENABLED)
set(HUPNP_FOUND false)
endif ()
macro_log_feature( HUPNP_FOUND "HUPnP" "UPnP support for Solid" "http://www.herqq.org" FALSE "" "Allows Solid to provide information about UPnP devices on the network" )
# message(STATUS "Building Solid KUPnP backend." ) # message(STATUS "Building Solid KUPnP backend." )
# set(solid_LIB_SRCS ${solid_LIB_SRCS} # set(solid_LIB_SRCS ${solid_LIB_SRCS}
@ -164,23 +163,26 @@ macro_log_feature( HUPNP_FOUND "HUPnP" "UPnP support for Solid" "http://www.herq
# backends/kupnp/kupnpmanager.cpp # backends/kupnp/kupnpmanager.cpp
# ) # )
macro_optional_find_package( UDev ) macro_optional_find_package(UDev)
set_package_properties(UDev PROPERTIES DESCRIPTION "UDev support for Solid" set_package_properties(UDev PROPERTIES
DESCRIPTION "UDev support for Solid"
URL "http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html" URL "http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
TYPE OPTIONAL
PURPOSE "Allows Solid to use UDev to provide information about devices on Linux" PURPOSE "Allows Solid to use UDev to provide information about devices on Linux"
) TYPE OPTIONAL
)
############### prefer udisks2 over udisks ############### prefer udisks2 over udisks
macro_optional_find_package( UDisks2 ) macro_optional_find_package(UDisks2)
set_package_properties(UDisks2 PROPERTIES DESCRIPTION "UDisks2 support for Solid" set_package_properties(UDisks2 PROPERTIES
DESCRIPTION "UDisks2 support for Solid"
URL "http://www.freedesktop.org/wiki/Software/udisks/" URL "http://www.freedesktop.org/wiki/Software/udisks/"
TYPE OPTIONAL
PURPOSE "Allows Solid to use UDisks2 to provide information about devices on Linux" PURPOSE "Allows Solid to use UDisks2 to provide information about devices on Linux"
) TYPE OPTIONAL
if ( UDISKS2_FOUND ) )
if(UDISKS2_FOUND )
set(WITH_SOLID_UDISKS2 ON) set(WITH_SOLID_UDISKS2 ON)
else () else()
set(WITH_SOLID_UDISKS2 OFF) set(WITH_SOLID_UDISKS2 OFF)
endif() endif()

View file

@ -7,29 +7,38 @@ include_directories(
# it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>) # it is the same as FIND_PACKAGE(<name>) but additionally creates an OPTION(WITH_<name>)
# so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF # so the checking for the software can be disabled via ccmake or -DWITH_<name>=OFF
macro_optional_find_package(HSPELL) macro_optional_find_package(HSPELL)
set_package_properties(HSPELL PROPERTIES DESCRIPTION "Spell checking support for Hebrew" set_package_properties(HSPELL PROPERTIES
URL "http://ivrix.org.il/projects/spell-checker/" URL "http://ivrix.org.il/projects/spell-checker/"
TYPE OPTIONAL TYPE OPTIONAL
PURPOSE "Hebrew support can also be provided via Enchant, providing the correct Enchant backends are installed" PURPOSE "Spell checking support for Hebrew"
) )
if (HSPELL_FOUND) if (HSPELL_FOUND)
add_subdirectory( hspell ) add_subdirectory( hspell )
endif (HSPELL_FOUND) endif (HSPELL_FOUND)
macro_optional_find_package(ENCHANT) macro_optional_find_package(ENCHANT)
set_package_properties(ENCHANT PROPERTIES DESCRIPTION "Spell checking support via Enchant" set_package_properties(ENCHANT PROPERTIES
DESCRIPTION "Spell checking support via Enchant"
URL "http://www.abisource.com/projects/enchant/" URL "http://www.abisource.com/projects/enchant/"
TYPE OPTIONAL TYPE OPTIONAL
) )
if (ENCHANT_FOUND) if(ENCHANT_FOUND)
add_subdirectory( enchant ) add_subdirectory(enchant)
endif (ENCHANT_FOUND) endif()
#macro_optional_find_package(HUNSPELL) # This is not needed for spell checking if Enchant is provided or only Hebrew
#macro_log_feature(HUNSPELL_FOUND "Hunspell" "Spell checking support via Hunspell" "http://hunspell.sourceforge.net/" FALSE "" "This is not needed for spell checking if Enchant is provided or only Hebrew spell checking is required.") # spell checking is required
#if (HUNSPELL_FOUND) #
# add_subdirectory( hunspell ) # macro_optional_find_package(HUNSPELL)
#endif (HUNSPELL_FOUND) # set_package_properties(HUNSPELL PROPERTIES
# PURPOSE "Spell checking support via Hunspell"
# URL "http://hunspell.sourceforge.net/"
# TYPE OPTIONAL
# )
if (HUNSPELL_FOUND)
add_subdirectory( hunspell )
endif (HUNSPELL_FOUND)