CMakeLists.txt 2.86 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
add_definitions(-DTRANSLATION_DOMAIN="libkmahjongg5")

ecm_setup_version(${libkmahjongg_VERSION}
    VARIABLE_PREFIX KMAHJONGGLIB
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kmahjongglib_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfigVersion.cmake"
    SOVERSION 5
)

set(kmahjongg_LIB_SRCS
   kmahjonggtileset.cpp
   kmahjonggbackground.cpp
   kmahjonggtilesetselector.cpp
   kmahjonggbackgroundselector.cpp
   kmahjonggconfigdialog.cpp
)

18
19
20
21
22
23
24
25
ecm_generate_headers(kmahjongg_LIB_CamelCase_HEADERS
    HEADER_NAMES
        KMahjonggTileset
        KMahjonggBackground
        KMahjonggConfigDialog
    REQUIRED_HEADERS kmahjongg_LIB_HEADERS
)

26
27
28
29
ecm_qt_declare_logging_category(kmahjongg_LIB_SRCS
    HEADER libkmahjongg_debug.h
    IDENTIFIER LIBKMAHJONGG_LOG
    CATEGORY_NAME log_libkmahjongg
30
31
    DESCRIPTION "libkmahjongg"
    EXPORT KMAHJONGG
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
)

ki18n_wrap_ui(kmahjongg_LIB_SRCS
    kmahjonggtilesetselector.ui
    kmahjonggbackgroundselector.ui
)

add_library(KF5KMahjongglib SHARED ${kmahjongg_LIB_SRCS})
generate_export_header(KF5KMahjongglib BASE_NAME libkmahjongg)

target_link_libraries(KF5KMahjongglib
    PUBLIC
        KF5::ConfigWidgets
        Qt5::Gui
    PRIVATE
        KF5::WidgetsAddons
        KF5::I18n
        KF5::Completion
        KF5::ConfigGui
        Qt5::Core
        Qt5::Svg
)

target_include_directories(KF5KMahjongglib
    INTERFACE
        "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg>"
        "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}>"
)

set_target_properties(KF5KMahjongglib PROPERTIES
    VERSION ${KMAHJONGGLIB_VERSION}
    SOVERSION ${KMAHJONGGLIB_SOVERSION}
    EXPORT_NAME KF5KMahjongglib
)


install(TARGETS KF5KMahjongglib
    EXPORT KF5KMahjonggLibraryDepends
    ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
)

install(FILES
    ${CMAKE_CURRENT_BINARY_DIR}/kmahjongglib_version.h
    ${CMAKE_CURRENT_BINARY_DIR}/libkmahjongg_export.h
76
77
    ${kmahjongg_LIB_HEADERS}
    ${kmahjongg_LIB_CamelCase_HEADERS}
78
79
80
81
82
83
    DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KF5KMahjongg
    COMPONENT Devel
)

export(TARGETS KF5KMahjongglib FILE "${PROJECT_BINARY_DIR}/KF5KMahjonggLibraryDepends.cmake")

84
85
86
87
88
89
ecm_qt_install_logging_categories(
    EXPORT KMAHJONGG
    FILE libkmahjongg.categories
    DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KF5KMahjongglib")

configure_package_config_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/KF5KMahjongglibConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
    "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5KMahjongglibConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
)

install(EXPORT KF5KMahjonggLibraryDepends
    DESTINATION ${CMAKECONFIG_INSTALL_DIR}
    COMPONENT Devel
)