CMakeLists.txt 4.84 KB
Newer Older
1
2
#
# Project
3
#
4
5
project(smb4k)

6
7
#
# Version
8
#
9
10
set(VERSION_MAJOR 3)
set(VERSION_MINOR 0)
Alexander Reinholdt's avatar
Alexander Reinholdt committed
11
set(VERSION_PATCH 81)
12
13
14

set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

15
#
16
# Minimum required CMake version
17
#
18
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
19

20
#
21
# CMake policies
22
#
23
cmake_policy(SET CMP0037 NEW)
24

25
26
27
if (POLICY CMP0071)
  cmake_policy(SET CMP0071 NEW)
endif()
28

29
#
30
# Minimum required versions of Qt5 and KF5
31
32
33
#
set(QT_MIN_VERSION "5.9.0")
set(KF5_MIN_VERSION "5.44.0")
34

35
#
36
37
# Adjustments
#
38
39
40
41
42
43
if(KF5_VERSION VERSION_GREATER "5.55.0")
    set(AUTHLIB KF5::AuthCore)
else()
    set(AUTHLIB KF5::Auth)
endif()

44
45
#
# Options for building Smb4K
46
#
47
# Install plasmoid
48
option(SMB4K_INSTALL_PLASMOID "Install the plasmoid" ON)
49

50
# Build with KDSoap WS Discovery client
51
option(SMB4K_WITH_WS_DISCOVERY "Build with WS-Discovery support for browsing" OFF)
52

53
54
#
# Required packages and includes
55
#
56
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
57
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/)
58
59

include(KDEInstallDirs)
Luigi Toscano's avatar
Luigi Toscano committed
60
include(KDECompilerSettings NO_POLICY_SCOPE)
61
62
include(KDECMakeSettings)
include(FeatureSummary)
Raymond Wooninck's avatar
Raymond Wooninck committed
63
include(ECMInstallIcons)
Pino Toscano's avatar
Pino Toscano committed
64
include(ECMSetupVersion)
65
include(CheckSymbolExists)
Pino Toscano's avatar
Pino Toscano committed
66
67

ecm_setup_version(${VERSION} VARIABLE_PREFIX SMB4K VERSION_HEADER smb4k_version.h)
68
69

# Qt5 modules
70
71
72
73
74
75
76
find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Gui ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Network ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5PrintSupport ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Qml ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Test ${QT_MIN_VERSION} REQUIRED)
find_package(Qt5Widgets ${QT_MIN_VERSION} REQUIRED)
77
78

# KF5 modules
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
find_package(KF5Auth ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5Completion ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5CoreAddons ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5DBusAddons ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5DocTools ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5IconThemes ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5JobWidgets ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5Notifications ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5Solid ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5Wallet ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5WindowSystem ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} REQUIRED)
96
97
find_package(KF5Crash ${KF5_MIN_VERSION} REQUIRED)
find_package(KF5DNSSD ${KF5_MIN_VERSION} REQUIRED)
98

99
# Install the plasmoid if desired
100
if (SMB4K_INSTALL_PLASMOID)
101
102
103
  find_package(KF5Plasma ${KF5_MIN_VERSION})
  set_package_properties(KF5Plasma PROPERTIES TYPE RUNTIME)
endif()
104

105
106
107
# Find libsmbclient.h
find_package(Libsmbclient REQUIRED MODULE)

108
109
110
111
112
113
114
115
116
# Check that the required smbc_* functions are provided
set(CMAKE_REQUIRED_LIBRARIES ${LIBSMBCLIENT_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${LIBSMBCLIENT_INCLUDE_DIRS})
check_symbol_exists(smbc_setOptionProtocols libsmbclient.h HAVE_SMBC_PROTOCOL)

if (NOT HAVE_SMBC_PROTOCOL)
  message("The function smbc_setOptionProtocols() is missing in Samba's client library's header file." FATAL_ERROR)
endif()

117
# Find KDSoap client
118
if (SMB4K_WITH_WS_DISCOVERY)
119
120
  find_package(KDSoap 1.9.0 REQUIRED)
  find_package(KDSoapWSDiscoveryClient 0.2 REQUIRED)
121
endif(SMB4K_WITH_WS_DISCOVERY)
122

123
#
124
125
# Make sure that Smb4K builds when several custom targets
# with the same name exist (happens in the po directory).
126
#
127
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po")
128
  set_property(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS ON)
129
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po")
130
131
132
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
endif()
133

134
#
135
# Make sure that all libraries, plugins, etc. are installed
136
# into the right place.
137
#
138
set(KDE_INSTALL_USE_QT_SYS_PATHS ON CACHE BOOLEAN "Use Qt system paths for installation" FORCE)
139

140
#
141
# Add subdirectories
142
#
143
144
145
146
147
add_subdirectory(core)
add_subdirectory(helpers)
add_subdirectory(smb4k)
add_subdirectory(data)
add_subdirectory(doc)
148

149
150
151
152
153
154
155
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po")
  ki18n_install(po)
  if(KF5DocTools_FOUND)
    kdoctools_install(po)
  endif(KF5DocTools_FOUND)
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po")

156
#
157
# Make adjustments according to the options set by the user
158
#
159
# Plasmoid: Notify the user and add the subdirectory if desired
160
161
if (SMB4K_INSTALL_PLASMOID)
  message(STATUS "Installing plasmoid (-DSMB4K_INSTALL_PLASMOID=OFF to disable)")
162
  add_subdirectory(plasmoid)
163
164
165
elseif(NOT SMB4K_INSTALL_PLASMOID)
  message(STATUS "Not installing plasmoid (-DSMB4K_INSTALL_PLASMOID=ON to enable)")
endif(SMB4K_INSTALL_PLASMOID)
166

167
168
########### install files ###############

169
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)