blob: beb9bef6826491f2987275d3f45946310f3ff750 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# Finds KDE frameworks 5 and its components, like e.g. karchive
#
# KF5_INCLUDE_DIRS - the include dirs of all requested components
# KF5_<comp>_LIBRARIES - the libraries to link against of all requested components
# KF5_<comp>_FOUND - signals whether the requested component <comp> has been found
# hmm, any better ideas ?
set(KF5_VERSION_STRING "5.0.0")
# we probably only want to search known components, so people don't start
# misusing this file for searching their own libraries.
set(knownComponentsTier1 itemmodels
karchive
kcodecs
kcoreaddons
kdbusaddons
kidletime
kjs
kplotting
kwidgetsaddons
kwindowsystem
solid
threadweaver)
set(knownComponentsTier2 kauth
kconfig)
set(knownComponentsTier3 )
set(allKnownComponents Compiler CMake InstallDirs ${knownComponentsTier1} ${knownComponentsTier2} ${knownComponentsTier3} )
set(cmakeCompRequested FALSE)
set(compilerCompRequested FALSE)
set(installDirsCompRequested FALSE)
unset(unknownComponents)
set(firstComponent )
set(followingComponents )
# iterate through the list of requested components, and check that we know them all.
# If not, fail.
foreach(comp ${KF5_FIND_COMPONENTS})
list(FIND allKnownComponents ${comp} index )
if("${index}" STREQUAL "-1")
list(APPEND unknownComponents "${comp}")
else()
if("${comp}" STREQUAL "CMake")
set(cmakeCompRequested TRUE)
elseif("${comp}" STREQUAL "Compiler")
set(compilerCompRequested TRUE)
elseif("${comp}" STREQUAL "InstallDirs")
set(installDirsCompRequested TRUE)
else()
if(NOT firstComponent)
set(firstComponent "${comp}")
else()
list(APPEND followingComponents "${comp}")
endif()
endif()
endif()
endforeach()
if(DEFINED unknownComponents)
set(msgType STATUS)
if(KF5_FIND_REQUIRED)
set(msgType FATAL_ERROR)
endif()
message(${msgType} "KF5: requested unknown components ${unknownComponents}")
return()
endif()
get_filename_component(_kf5KdeModuleDir "${CMAKE_CURRENT_LIST_DIR}/../kde-modules" REALPATH)
if(installDirsCompRequested)
include("${_kf5KdeModuleDir}/KDEInstallDirs.cmake")
if(NOT KF5_FIND_QUIETLY)
message(STATUS "KF5[InstallDirs]: Loaded settings from ${_kf5KdeModuleDir}/KDEInstallDirs.cmake")
endif()
set(KF5_InstallDirs_FOUND TRUE)
endif()
if(cmakeCompRequested)
include("${_kf5KdeModuleDir}/KDECMakeSettings.cmake")
if(NOT KF5_FIND_QUIETLY)
message(STATUS "KF5[CMake]: Loaded settings from ${_kf5KdeModuleDir}/KDECMakeSettings.cmake")
endif()
set(KF5_CMake_FOUND TRUE)
endif()
if(compilerCompRequested)
include("${_kf5KdeModuleDir}/KDECompilerSettings.cmake")
if(NOT KF5_FIND_QUIETLY)
message(STATUS "KF5[Compiler]: Loaded settings from ${_kf5KdeModuleDir}/KDECompilerSettings.cmake")
endif()
set(KF5_Compiler_FOUND TRUE)
endif()
unset(KF5_INCLUDE_DIRS)
unset(KF5_LIBRARIES)
macro(_KF5_HANDLE_COMPONENT _comp)
set(KF5_${_comp}_FOUND TRUE)
if(NOT KF5_FIND_QUIETLY)
message(STATUS "KF5[${_comp}]: Loaded ${${_comp}_CONFIG}")
endif()
if(NOT DEFINED ${_comp}_INCLUDE_DIRS)
message(FATAL_ERROR "${_comp} does not set ${_comp}_INCLUDE_DIRS !")
endif()
if(NOT DEFINED ${_comp}_LIBRARIES)
message(FATAL_ERROR "${_comp} does not set ${_comp}_LIBRARIES !")
endif()
set(KF5_INCLUDE_DIRS ${KF5_INCLUDE_DIRS} ${${_comp}_INCLUDE_DIRS} )
set(KF5_LIBRARIES ${KF5_LIBRARIES} ${${_comp}_LIBRARIES} )
endmacro()
if(firstComponent)
file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
set(_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} )
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${_KDEDIRS} )
find_package(${firstComponent} ${KF5_FIND_VERSION} CONFIG )
set(KF5_File "${${firstComponent}_CONFIG}}")
if(${firstComponent}_CONFIG)
if(NOT DEFINED ${firstComponent}_INSTALL_PREFIX)
message(STATUS "${firstComponent} does not set ${firstComponent}_INSTALL_PREFIX !")
endif()
_kf5_handle_component(${firstComponent})
endif()
# search for the other components first in the same directory where the first one
# has been found, and additionally in KDEDIRS. This is to make sure we don't
# get a random mix of installed KDE libraries.
set(CMAKE_PREFIX_PATH ${${firstComponent}_INSTALL_PREFIX} ${_KDEDIRS})
foreach(comp ${followingComponents})
find_package(${comp} ${KF5_FIND_VERSION} CONFIG
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_BUILDS_PATH
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
)
if(${comp}_CONFIG)
_kf5_handle_component(${comp})
endif()
endforeach()
set(CMAKE_PREFIX_PATH ${_CMAKE_PREFIX_PATH} )
else()
set(KF5_File "${CMAKE_CURRENT_LIST_FILE}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(KF5
REQUIRED_VARS KF5_File
VERSION_VAR KF5_VERSION_STRING
HANDLE_COMPONENTS
)
|