CMakeLists.txt 2.86 KB
Newer Older
1
2
add_definitions(-DTRANSLATION_DOMAIN="libkcddb")

3
4
5
6
if(MUSICBRAINZ5_FOUND)
    set(musicbrainz_sources
       musicbrainz/musicbrainzlookup.cpp
       musicbrainz/asyncmusicbrainzlookup.cpp)
7

8
9
10
11
12
13
14
    if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
        set(enable_exceptions -EHsc)
    elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        set(enable_exceptions "-fexceptions -UQT_NO_EXCEPTIONS")
    elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
        set(enable_exceptions -fexceptions)
    endif()
15

16
17
    set_source_files_properties(${musicbrainz_sources} PROPERTIES COMPILE_FLAGS ${enable_exceptions})
endif()
18

19
kconfig_add_kcfg_files(kcfg_sources configbase.kcfgc)
20

21
22
23
24
25
26
27
28
ecm_qt_declare_logging_category(log_sources
    HEADER logging.h
    IDENTIFIER LIBKCDDB
    CATEGORY_NAME "libkcddb"
    DESCRIPTION "libkcddb"
    EXPORT KCDDB
)

29
add_library(KF5Cddb SHARED
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    cache.cpp
    cdinfo.cpp
    kcddbconfig.cpp
    client.cpp
    kcddb.cpp
    cddb.cpp
    lookup.cpp
    cddbplookup.cpp
    synccddbplookup.cpp
    asynccddbplookup.cpp
    httplookup.cpp
    synchttplookup.cpp
    asynchttplookup.cpp
    smtpsubmit.cpp
    asyncsmtpsubmit.cpp
    syncsmtpsubmit.cpp
    submit.cpp
    sites.cpp
    httpsubmit.cpp
    asynchttpsubmit.cpp
    synchttpsubmit.cpp
    categories.cpp
    genres.cpp
    ${musicbrainz_sources}
54
    ${log_sources}
55
    ${kcfg_sources})
56

57
target_link_libraries(KF5Cddb
58
59
60
61
62
    PUBLIC
        KF5::ConfigGui
    PRIVATE
        KF5::I18n
        KF5::KIOCore
63
64
65
        Qt5::Network)

if(MUSICBRAINZ5_FOUND)
66
    target_link_libraries(KF5Cddb PRIVATE musicbrainz)
67
endif()
68

69
70
71
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>")
72

73
74
75
76
set_target_properties(KF5Cddb PROPERTIES VERSION ${KCDDB_VERSION_STRING} 
    SOVERSION ${KCDDB_SOVERSION}
    EXPORT_NAME Cddb
)
77

78
79
80
81
82
83
84
85
86
87
88
89
90
ecm_generate_headers(KCddb_HEADERS
    HEADER_NAMES
    Categories
    Cdinfo
    Client
    Genres
    KcddbConfig
    Kcddb

    REQUIRED_HEADERS KCddb_HEADERS
)

install(TARGETS KF5Cddb EXPORT KF5CddbTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
91
92

install(FILES
93
94
95
96
97
98
99
100
101
102
    ${CMAKE_CURRENT_BINARY_DIR}/kcddb_export.h
    ${CMAKE_CURRENT_BINARY_DIR}/configbase.h
    ${KCddb_HEADERS}
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KCddb 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})

103
install(FILES libkcddb5.kcfg DESTINATION ${KCFG_INSTALL_DIR})
104
105
106
107
108
109

ecm_qt_install_logging_categories(
    EXPORT KCDDB
    FILE libkcddb.categories
    DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}"
)