-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnano-client-config.cmake.in
65 lines (49 loc) · 2.02 KB
/
nano-client-config.cmake.in
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
@PACKAGE_INIT@
# This macro enables usage of find_dependency().
# https://cmake.org/cmake/help/v3.11/module/CMakeFindDependencyMacro.html
include(CMakeFindDependencyMacro)
get_filename_component(nano-client_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(nano-client_COMPONENTS
client
clientudpv4
clientserial)
set(nano-core_FIND_COMPONENTS ${nano-client_FIND_COMPONENTS})
function(_load_client_dependecies type)
list(FIND nano-core_FIND_COMPONENTS client${type} _transport_REQUIRED)
if(_transport_REQUIRED GREATER_EQUAL 0)
list(FIND nano-core_FIND_COMPONENTS transport${type} _transport_REQUESTED)
if(_transport_REQUESTED EQUAL -1)
list(APPEND nano-core_FIND_COMPONENTS transport${type})
endif()
endif()
set(nano-core_FIND_COMPONENTS ${nano-core_FIND_COMPONENTS} PARENT_SCOPE)
endfunction()
_load_client_dependecies(udpv4)
_load_client_dependecies(serial)
if(NOT "${nano-core_FIND_COMPONENTS}" STREQUAL "")
list(REMOVE_ITEM nano-core_FIND_COMPONENTS ${nano-client_COMPONENTS})
if(NOT "${nano-core_FIND_COMPONENTS}" STREQUAL "")
find_dependency(nano-core CONFIG REQUIRED
COMPONENTS ${nano-core_FIND_COMPONENTS})
list(REMOVE_ITEM nano-client_FIND_COMPONENTS ${nano-core_FIND_COMPONENTS})
endif()
else()
find_dependency(nano-core CONFIG REQUIRED)
endif()
if (NOT TARGET nano::nanoclient)
include(${nano-client_DIR}/nano-client-client-targets.cmake)
endif()
foreach(_req_component IN LISTS nano-client_FIND_COMPONENTS)
list(FIND nano-client_COMPONENTS "${_req_component}" _req_component_FOUND)
if (_req_component_FOUND EQUAL -1)
set(nano-client_FOUND
False)
set(nano-client_NOT_FOUND_MESSAGE
"Unsupported nano-client component: ${_req_component}")
endif()
if (NOT TARGET nano::nano${_req_component})
include(${nano-client_DIR}/nano-client-${_req_component}-targets.cmake)
endif()
set(nano-client_${_req_component}_FOUND true)
endforeach()
check_required_components(nano-client)