-
Notifications
You must be signed in to change notification settings - Fork 5
/
Config.cmake.in
75 lines (64 loc) · 3.49 KB
/
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
63
64
65
66
67
68
69
70
71
72
73
74
75
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
set(${CMAKE_FIND_PACKAGE_NAME}_VERSION @PROJECT_VERSION@ CACHE INTERNAL "${CMAKE_FIND_PACKAGE_NAME} version")
@PACKAGE_INIT@
cmake_minimum_required(VERSION 3.19)
function(maybe_message type message)
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY )
message(${type} "${message}")
endif()
endfunction()
macro(load_targets type)
if (NOT EXISTS "${${CMAKE_FIND_PACKAGE_NAME}_${type}_targets}")
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} `${type}` libraries were requested but not found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
include("${${CMAKE_FIND_PACKAGE_NAME}_${type}_targets}")
endmacro()
include(CMakeFindDependencyMacro)
maybe_message(STATUS "Finding dependency App for ${CMAKE_FIND_PACKAGE_NAME}")
find_dependency(App REQUIRED PATHS $ENV{${CMAKE_FIND_PACKAGE_NAME}_DIR} ${CMAKE_CURRENT_LIST_DIR}/.. ${${CMAKE_FIND_PACKAGE_NAME}_ROOT})
set(${CMAKE_FIND_PACKAGE_NAME}_static_targets "${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-static-targets.cmake")
set(${CMAKE_FIND_PACKAGE_NAME}_shared_targets "${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-shared-targets.cmake")
if ("@WITH_OMPI@")
set(${CMAKE_FIND_PACKAGE_NAME}_targets "${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME} ${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME}-ompi")
else()
set(${CMAKE_FIND_PACKAGE_NAME}_targets "${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME}")
endif()
# Ensure every requested component is valid and that static and shared
# were not both specified
set(${CMAKE_FIND_PACKAGE_NAME}_known_comps static shared)
set(${CMAKE_FIND_PACKAGE_NAME}_comp_static NO)
set(${CMAKE_FIND_PACKAGE_NAME}_comp_shared NO)
set(_shared_or_static static)
foreach (comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
if (comp IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_known_comps)
set(${CMAKE_FIND_PACKAGE_NAME}_comp_${comp} YES)
set(_shared_or_static ${comp})
else ()
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} does not recognize component `${comp}`")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
endforeach ()
if (${CMAKE_FIND_PACKAGE_NAME}_comp_static AND ${CMAKE_FIND_PACKAGE_NAME}_comp_shared)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"${CMAKE_FIND_PACKAGE_NAME} `static` and `shared` components are mutually exclusive")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
load_targets(static)
load_targets(shared)
add_library(${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME} ALIAS ${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME}-${_shared_or_static})
add_library(${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME}-ompi ALIAS ${CMAKE_FIND_PACKAGE_NAME}::${CMAKE_FIND_PACKAGE_NAME}-ompi-${_shared_or_static})
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY )
message(STATUS "Found ${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_VERSION} in ${PACKAGE_PREFIX_DIR}")
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
message(STATUS "Components ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}")
endif()
message(STATUS "Imported targets for ${_shared_or_static} libraries: ${${CMAKE_FIND_PACKAGE_NAME}_targets}")
endif()
unset(_shared_or_static)
endif()