CMakeLists.txt 6.69 KB
Newer Older
Elvis Angelaccio's avatar
Elvis Angelaccio committed
1
cmake_minimum_required(VERSION 3.0)
2 3

# KDE Applications Version, managed by release script
4
set (RELEASE_SERVICE_VERSION_MAJOR "20")
5
set (RELEASE_SERVICE_VERSION_MINOR "04")
6
set (RELEASE_SERVICE_VERSION_MICRO "1")
7 8
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(kio-extras VERSION ${RELEASE_SERVICE_VERSION})
9

10 11
include(FeatureSummary)

Laurent Montel's avatar
Laurent Montel committed
12
set(QT_MIN_VERSION "5.11.0")
13
set(KF5_MIN_VERSION "5.66.0")
14
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus Network Widgets Svg)
15 16 17 18 19 20 21 22 23 24

find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
         PURPOSE "Required for tests"
         TYPE OPTIONAL
         )
add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
if (NOT Qt5Test_FOUND)
    set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()
25

26
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
27
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
28

29
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Hrvoje Senjan's avatar
Hrvoje Senjan committed
30 31 32 33 34 35 36 37 38 39 40
    Archive
    Config
    ConfigWidgets
    CoreAddons
    DBusAddons
    DocTools
    DNSSD
    IconThemes
    I18n
    KIO
    Solid
Laurent Montel's avatar
Laurent Montel committed
41 42
    Bookmarks
    GuiAddons
43
    SyntaxHighlighting
Hrvoje Senjan's avatar
Hrvoje Senjan committed
44
)
45 46 47 48
# As this is the check used for linkage, only require it in the same location...
if (UNIX)
    find_package(KF5Pty ${KF5_MIN_VERSION} REQUIRED)
endif()
Laurent Montel's avatar
Laurent Montel committed
49

50
include(CheckIncludeFile)
Kevin Funk's avatar
Kevin Funk committed
51
include(CMakePackageConfigHelpers)
52 53
include(KDEInstallDirs)
include(KDECMakeSettings)
54
include(KDECompilerSettings NO_POLICY_SCOPE)
55 56
include(ECMMarkNonGuiExecutable)
include(ECMMarkAsTest)
57
include(ECMOptionalAddSubdirectory)
58
include(ECMQtDeclareLoggingCategory)
59

60 61
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)

62 63 64 65 66 67
find_package(KF5Activities QUIET)
set_package_properties(KF5Activities PROPERTIES
    PURPOSE "Provides the activities:/ kioslave and fileitem plugin."
    TYPE OPTIONAL
)

68 69 70 71 72 73
find_package(Qt5Sql QUIET)
set_package_properties(Qt5Sql PROPERTIES
    PURPOSE "Provides the activities:/ kioslave and fileitem plugin."
    TYPE OPTIONAL
)

74
find_package(KF5ActivitiesStats 5.62 QUIET)
75 76 77 78 79
set_package_properties(KF5ActivitiesStats PROPERTIES
    PURPOSE "Provides the recentlyused:/ kioslave."
    TYPE OPTIONAL
)

80 81 82 83 84 85
find_package(Phonon4Qt5 4.6.60 NO_MODULE)
set_package_properties(Phonon4Qt5 PROPERTIES
   DESCRIPTION "Qt-based audio library"
   PURPOSE "Required for the audio preview plugin"
   TYPE OPTIONAL)

86
include_directories(${CMAKE_CURRENT_BINARY_DIR})
87

88
if(NOT WIN32)
89 90 91 92 93
    # we need a version of samba which has already smbc_set_context(), Alex
    set(SAMBA_REQUIRE_SMBC_SET_CONTEXT TRUE)
    set(SAMBA_REQUIRE_SMBC_OPTION_SET TRUE)
    find_package(Samba)
    set_package_properties(Samba PROPERTIES DESCRIPTION "the SMB client library, a version with smbc_set_context() and smbc_option_set()"
94
                        URL "https://www.samba.org/"
95 96 97
                        TYPE OPTIONAL
                        PURPOSE "Needed to build the SMB kioslave"
                        )
98
endif()
99

100 101
find_package(libssh 0.7.0 MODULE)
set_package_properties(libssh PROPERTIES DESCRIPTION "the SSH library with SFTP support"
102
                       URL "https://www.libssh.org/"
103 104 105
                       TYPE OPTIONAL
                       PURPOSE "Needed to build the SFTP kioslave"
                      )
Carlo Segato's avatar
Carlo Segato committed
106

Jan Grulich's avatar
Jan Grulich committed
107 108 109 110 111 112 113
find_package(Mtp)
set_package_properties(Mtp PROPERTIES DESCRIPTION "the MTP library"
                       URL "http://libmtp.sourceforge.net/"
                       TYPE OPTIONAL
                       PURPOSE "Needed to build the MTP kioslave"
                       )

114 115
check_include_file(utime.h HAVE_UTIME_H)

Harald Sitter's avatar
Harald Sitter committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
# ECM's KDECompilerSettings.cmake should take care of enabling supporting on
# 32bit architectures.
# Thorw a fatal error if off_t isn't >=64bit to ensure that large files are working
# as expected.
# BUG: 165449
if(UNIX)
    check_cxx_source_compiles("
        #include <sys/types.h>
        /* Check that off_t can represent 2**63 - 1 correctly.
            We can't simply define LARGE_OFF_T to be 9223372036854775807,
            since some C++ compilers masquerading as C compilers
            incorrectly reject 9223372036854775807.  */
        #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))

        int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1];
        int main() { return 0; }
    "
    OFFT_IS_64BIT)

    if(NOT OFFT_IS_64BIT)
        message(FATAL_ERROR "Large file support is not enabled.")
    endif()
138 139 140 141 142

    find_package(Gperf)
    set_package_properties(Gperf PROPERTIES TYPE OPTIONAL
                           PURPOSE "Needed to build the man kioslave"
                           )
143 144 145 146 147

    find_package(TIRPC)
    set_package_properties(TIRPC PROPERTIES TYPE OPTIONAL
                           PURPOSE "Needed to build the NFS kioslave"
                           )
Harald Sitter's avatar
Harald Sitter committed
148 149 150 151
else()
    # FIXME: on windows we ignore support until trash gets integrated
endif()

152 153
add_subdirectory( doc )

154
add_subdirectory( about )
155
if(TARGET KF5::Activities AND TARGET Qt5::Sql)
156 157
  add_subdirectory( activities )
endif()
158 159 160
if(KF5ActivitiesStats_FOUND)
    add_subdirectory( recentlyused )
endif()
161
add_subdirectory( bookmarks )
162
add_subdirectory( filter )
163 164 165
if(Phonon4Qt5_FOUND)
    add_subdirectory( kfileaudiopreview )
endif()
166
add_subdirectory( info )
167 168 169 170
add_subdirectory( archive )
if(NOT WIN32)
    add_subdirectory( network )
endif()
171
add_subdirectory( recentdocuments )
Kevin Funk's avatar
Kevin Funk committed
172 173 174 175 176
if (NOT WIN32)
    # does not compile: fish.cpp(41): fatal error C1083: Cannot open include file: 'sys/resource.h': No such file or directory
    # Used for getting the resource limit for closing all child process FDs. Could be completely replaced by fcloseall() if available for Unix or _fcloseall() for Windows, either conditionally on Q_OS_type or using a configure test.
    add_subdirectory( fish )
endif()
177
add_subdirectory( thumbnail )
178
add_subdirectory( docfilter )
179
if (libssh_FOUND)
Kevin Funk's avatar
Kevin Funk committed
180
    add_subdirectory(sftp)
181
endif ()
182
add_subdirectory(settings)
183
add_subdirectory( filenamesearch )
Jan Grulich's avatar
Jan Grulich committed
184 185 186
if (MTP_FOUND)
  add_subdirectory(mtp)
endif()
187

188
if(NOT WIN32)
189
   if(Gperf_FOUND)
190 191
     add_subdirectory( man )
   endif()
192
   if(TIRPC_FOUND)
193 194
     add_subdirectory( nfs )
   endif()
195
endif()
196

197 198
# KDNSSD before 5.54 suffers from a race condition in avahi's dbus API and
# ideally should not be used in ways that can deadlock a slave.
199
if(${KF5DNSSD_FOUND} AND ${KF5DNSSD_VERSION} VERSION_GREATER "5.53")
200 201 202
    set(HAVE_KDNSSD_WITH_SIGNAL_RACE_PROTECTION TRUE)
endif()

203 204 205
if(SAMBA_FOUND)
    add_subdirectory(smb)
endif()
206 207

configure_file (config-runtime.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-runtime.h )
208

Laurent Montel's avatar
Laurent Montel committed
209
install(FILES kio-extras.categories DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
210

Ralf Habacker's avatar
Ralf Habacker committed
211

212
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)