Commit d9c5eff8 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use more target-centric cmake code

Also move cmake config generation into src/ folder

GIT_SILENT
parent f468f82e
......@@ -24,13 +24,6 @@ include(ECMGenerateHeaders)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Network Widgets)
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Config DocTools I18n KIO WidgetsAddons)
ecm_setup_version(${libkcddb_VERSION}
VARIABLE_PREFIX KCDDB
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfigVersion.cmake"
SOVERSION 5
)
find_package(MusicBrainz5)
set_package_properties(MusicBrainz5 PROPERTIES
DESCRIPTION "Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz"
......@@ -66,31 +59,4 @@ if(BUILD_TESTING)
add_subdirectory(tests)
endif()
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Cddb")
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5CddbConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT
KF5CddbTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE KF5CddbTargets.cmake
NAMESPACE KF5::
COMPONENT Devel
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h"
DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF5}"
COMPONENT Devel
)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -2,12 +2,14 @@ add_definitions(-DTRANSLATION_DOMAIN="libkcddb")
add_subdirectory(doc)
ki18n_wrap_ui(ui_sources cddbconfigwidget.ui)
add_library(kcm_cddb MODULE)
add_library(kcm_cddb MODULE
ki18n_wrap_ui(kcm_cddb cddbconfigwidget.ui)
target_sources(kcm_cddb PRIVATE
cddbconfigwidget.cpp
kcmcddb.cpp
${ui_sources})
)
set_source_files_properties(cddbconfigwidget.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ui_cddbconfigwidget.h)
......
add_definitions(-DTRANSLATION_DOMAIN="libkcddb")
set(KCDDB_INSTALL_INCLUDEDIR "${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb")
set(KCDDB_CMAKECONFIG_NAME "KF5Cddb")
ecm_setup_version(${libkcddb_VERSION}
VARIABLE_PREFIX KCDDB
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/${KCDDB_CMAKECONFIG_NAME}ConfigVersion.cmake"
SOVERSION 5
)
add_library(KCddb SHARED)
add_library(KF5::Cddb ALIAS KCddb)
if(MUSICBRAINZ5_FOUND)
set(musicbrainz_sources
musicbrainz/musicbrainzlookup.cpp
......@@ -16,9 +29,9 @@ if(MUSICBRAINZ5_FOUND)
set_source_files_properties(${musicbrainz_sources} PROPERTIES COMPILE_FLAGS ${enable_exceptions})
endif()
kconfig_add_kcfg_files(kcfg_sources configbase.kcfgc)
kconfig_add_kcfg_files(KCddb configbase.kcfgc)
ecm_qt_declare_logging_category(log_sources
ecm_qt_declare_logging_category(KCddb
HEADER logging.h
IDENTIFIER LIBKCDDB
CATEGORY_NAME "libkcddb"
......@@ -26,7 +39,7 @@ ecm_qt_declare_logging_category(log_sources
EXPORT KCDDB
)
add_library(KF5Cddb SHARED
target_sources(KCddb PRIVATE
cache.cpp
cdinfo.cpp
kcddbconfig.cpp
......@@ -51,55 +64,60 @@ add_library(KF5Cddb SHARED
categories.cpp
genres.cpp
${musicbrainz_sources}
${log_sources}
${kcfg_sources})
)
target_link_libraries(KF5Cddb
target_link_libraries(KCddb
PUBLIC
KF5::ConfigGui
PRIVATE
KF5::I18n
KF5::KIOCore
Qt5::Network)
Qt5::Network
)
if(MUSICBRAINZ5_FOUND)
target_link_libraries(KF5Cddb PRIVATE musicbrainz)
target_link_libraries(KCddb PRIVATE musicbrainz)
endif()
generate_export_header(KF5Cddb BASE_NAME KCddb)
add_library(KF5::Cddb ALIAS KF5Cddb)
target_include_directories(KF5Cddb PUBLIC "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb>")
generate_export_header(KCddb BASE_NAME KCddb)
target_include_directories(KCddb
PUBLIC
"$<INSTALL_INTERFACE:${KCDDB_INSTALL_INCLUDEDIR}>"
)
set_target_properties(KF5Cddb PROPERTIES
set_target_properties(KCddb PROPERTIES
VERSION ${KCDDB_VERSION}
SOVERSION ${KCDDB_SOVERSION}
OUTPUT_NAME KF5Cddb
EXPORT_NAME Cddb
)
ecm_generate_headers(KCddb_HEADERS
HEADER_NAMES
Categories
Cdinfo
Client
Genres
KcddbConfig
Kcddb
Categories
Cdinfo
Client
Genres
KcddbConfig
Kcddb
REQUIRED_HEADERS KCddb_HEADERS
)
install(TARGETS KF5Cddb EXPORT KF5CddbTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS KCddb EXPORT KCddbTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/kcddb_export.h
${CMAKE_CURRENT_BINARY_DIR}/configbase.h
${KCddb_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb COMPONENT Devel
DESTINATION ${KCDDB_INSTALL_INCLUDEDIR}
COMPONENT Devel
)
include(ECMGeneratePriFile)
ecm_generate_pri_file(BASE_NAME KCddb LIB_NAME KF5Cddb DEPS "Qt5Widgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h"
DESTINATION "${KDE_INSTALL_INCLUDEDIR_KF5}"
COMPONENT Devel
)
install(FILES libkcddb5.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
......@@ -108,3 +126,34 @@ ecm_qt_install_logging_categories(
FILE libkcddb.categories
DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
)
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/${KCDDB_CMAKECONFIG_NAME}")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/${KCDDB_CMAKECONFIG_NAME}Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${KCDDB_CMAKECONFIG_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${KCDDB_CMAKECONFIG_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${KCDDB_CMAKECONFIG_NAME}ConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KCddbTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE ${KCDDB_CMAKECONFIG_NAME}Targets.cmake
NAMESPACE KF5::
COMPONENT Devel
)
include(ECMGeneratePriFile)
ecm_generate_pri_file(
BASE_NAME KCddb
LIB_NAME KF5Cddb
DEPS "Qt5Widgets"
FILENAME_VAR PRI_FILENAME
INCLUDE_INSTALL_DIR ${KCDDB_INSTALL_INCLUDEDIR}
)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Widgets "@QT_MIN_VERSION@")
find_dependency(KF5Config "@KF_MIN_VERSIONN@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5CddbTargets.cmake")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment