CMakeLists.txt 2.62 KB
Newer Older
1
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
2

3
project(libkcddb VERSION "5.0.0")
4

5
6
set(QT_MIN_VERSION 5.12.0)
set(KF_MIN_VERSION 5.68.0)
7

8
9
# ECM setup
include(FeatureSummary)
10
find_package(ECM ${KF_MIN_VERSION}  NO_MODULE)
11
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
12
13
14
set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(KDEInstallDirs)
15
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
16
17
include(KDECMakeSettings)
include(GenerateExportHeader)
18
include(ECMSetupVersion)
19
include(ECMQtDeclareLoggingCategory)
20
include(CMakePackageConfigHelpers)
21
include(ECMGenerateHeaders)
22

23
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Network Widgets)
24
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Config DocTools I18n KIO WidgetsAddons)
25

26
ecm_setup_version(${libkcddb_VERSION}
27
    VARIABLE_PREFIX KCDDB
28
29
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kcddb_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfigVersion.cmake"
30
    SOVERSION 5
31
)
Laurent Montel's avatar
Laurent Montel committed
32

33
34
find_package(MusicBrainz5)
set_package_properties(MusicBrainz5 PROPERTIES
35
   DESCRIPTION "Music metadata lookup for KDE multimedia applications through libkcddb. You need version 5.x of libmusicbrainz"
Yuri Chornoivan's avatar
Yuri Chornoivan committed
36
   URL "https://www.musicbrainz.org"
37
38
   TYPE OPTIONAL
   PURPOSE "A library that provides access to metadata lookup on the MusicBrainz server")
39
40
41

if(MUSICBRAINZ5_FOUND)
    set(HAVE_MUSICBRAINZ5 1)
42
else()
43
    set(HAVE_MUSICBRAINZ5 0)
44
endif()
45

46
configure_file(config-musicbrainz.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-musicbrainz.h )
47
include_directories(${CMAKE_CURRENT_BINARY_DIR})
48

49
50
add_subdirectory(kcmcddb)
add_subdirectory(libkcddb)
51

Andreas Sturmlechner's avatar
Andreas Sturmlechner committed
52
53
if(BUILD_TESTING)
    find_package(Qt5Test REQUIRED)
54
    add_subdirectory(tests)
Andreas Sturmlechner's avatar
Andreas Sturmlechner committed
55
56
endif()

57
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5Cddb")
58
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5CddbConfig.cmake.in"
59
60
61
                              "${CMAKE_CURRENT_BINARY_DIR}/KF5CddbConfig.cmake"
                              INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
62

63
install(FILES
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
    "${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 "${KF5_INCLUDE_INSTALL_DIR}"
    COMPONENT Devel
)

84
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)