forked from lbcb-sci/raven
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ravenConfig.cmake
57 lines (52 loc) · 1.83 KB
/
ravenConfig.cmake
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
cmake_minimum_required(VERSION 3.11)
set(raven_known_comps static shared)
set(raven_comp_static NO)
set(raven_comp_shared NO)
foreach (raven_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
if (raven_comp IN_LIST raven_known_comps)
set(raven_comp_${raven_comp} YES)
else ()
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"raven does not recognize component `${raven_comp}`.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
endforeach ()
if (raven_comp_static AND raven_comp_shared)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"raven `static` and `shared` components are mutually exclusive.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
set(raven_static_targets "${CMAKE_CURRENT_LIST_DIR}/raven-static-targets.cmake")
set(raven_shared_targets "${CMAKE_CURRENT_LIST_DIR}/raven-shared-targets.cmake")
macro(raven_load_targets type)
if (NOT EXISTS "${raven_${type}_targets}")
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
"raven `${type}` libraries were requested but not found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
return()
endif ()
include("${raven_${type}_targets}")
endmacro()
if (raven_comp_static)
raven_load_targets(static)
elseif (raven_comp_shared)
raven_load_targets(shared)
elseif (DEFINED raven_SHARED_LIBS AND raven_SHARED_LIBS)
raven_load_targets(shared)
elseif (DEFINED raven_SHARED_LIBS AND NOT raven_SHARED_LIBS)
raven_load_targets(static)
elseif (BUILD_SHARED_LIBS)
if (EXISTS "${raven_shared_targets}")
raven_load_targets(shared)
else ()
raven_load_targets(static)
endif ()
else ()
if (EXISTS "${raven_static_targets}")
raven_load_targets(static)
else ()
raven_load_targets(shared)
endif ()
endif ()