-
Notifications
You must be signed in to change notification settings - Fork 1
/
addNestedDependencies.cmake
101 lines (65 loc) · 3.22 KB
/
addNestedDependencies.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
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
include(getDependencyPath)
# -------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------
function (addNestedIncludeDirectories dependency_name include_directories_list)
set(recursion FALSE)
set (extra_macro_args ${ARGN})
# Did we get any optional args?
list(LENGTH extra_macro_args num_extra_args)
if (${num_extra_args} GREATER 0)
set(recursion TRUE)
endif ()
string(REPLACE "%" ";" dependency ${dependency_name})
list(GET dependency 0 dependency_lib_name)
#MESSAGE("dependency_lib_name: ${dependency_lib_name} ${recursion}")
if (NOT recursion)
set(include_directories_local "${include_directories_list}" CACHE INTERNAL "" )
endif (NOT recursion)
string(TOUPPER ${dependency_lib_name} tmp)
#getDependencyPath(${dependency_name})
#MESSAGE("------------> ${${tmp}_INCLUDE_DIR}")
set(include_directories_local ${include_directories_local} "${${tmp}_INCLUDE_DIR}" CACHE INTERNAL "" )
#MESSAGE("include_directories_local: ${include_directories_local}")
#include(Dependencies_${dependency_lib_name}${SHIPPABLE_SUFFIX} OPTIONAL RESULT_VARIABLE NESTED_DEPENDENCIES)
#if (NESTED_DEPENDENCIES)
# foreach (sub_dependency ${Dependencies_${dependency_lib_name}})
# Library name
# addNestedIncludeDirectories(${sub_dependency} "${include_directories_local}" TRUE)
# endforeach(sub_dependency)
#ENDif (NESTED_DEPENDENCIES)
set(include_directories_list ${include_directories_local} PARENT_SCOPE)
endfunction()
# -------------------------------------------------------------------------------
#
# -------------------------------------------------------------------------------
function (addNestedLibraries dependency_name target_link_libraries_list)
set(recursion FALSE)
set (extra_macro_args ${ARGN})
#MESSAGE("")
# Did we get any optional args?
list(LENGTH extra_macro_args num_extra_args)
if (${num_extra_args} GREATER 0)
set(recursion TRUE)
endif ()
string(REPLACE "%" ";" dependency ${dependency_name})
list(GET dependency 0 dependency_lib_name)
#MESSAGE("dependency_lib_name: ${dependency_lib_name} ${recursion}")
if (NOT recursion)
set(target_link_libraries_local "${target_link_libraries_list}" CACHE INTERNAL "" )
endif (NOT recursion)
string(TOUPPER ${dependency_lib_name} tmp)
#getDependencyPath(${dependency_lib_name})
set(target_link_libraries_local ${target_link_libraries_local} "${${tmp}_LIBRARIES}" CACHE INTERNAL "" )
#MESSAGE("target_link_libraries_local: ${target_link_libraries_local}")
#include(Dependencies_${dependency_lib_name}${SHIPPABLE_SUFFIX} OPTIONAL RESULT_VARIABLE NESTED_DEPENDENCIES)
#if (NESTED_DEPENDENCIES)
# foreach (sub_dependency ${Dependencies_${dependency_lib_name}})
# Library name
# addNestedLibraries(${sub_dependency} "${target_link_libraries_local}" TRUE)
#string(TOUPPER ${sub_dependency_lib_name} tmp)
#set(target_link_libraries_local ${target_link_libraries_local} "${${tmp}_LIBRARIES}" CACHE INTERNAL "" )
# endforeach(sub_dependency)
# endif (NESTED_DEPENDENCIES)
set(target_link_libraries_list ${target_link_libraries_local} PARENT_SCOPE)
endfunction()