-
Notifications
You must be signed in to change notification settings - Fork 16
/
Config.cmake.in
192 lines (158 loc) · 7.07 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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# ============================================================================
# Copyright (c) 2011-2012 University of Pennsylvania
# Copyright (c) 2013-2014 Andreas Schuh
# All rights reserved.
#
# See COPYING file for license information or visit
# http://opensource.andreasschuh.com/cmake-basis/download.html#license
# ============================================================================
##############################################################################
# @file @CONFIG_FILE@
# @brief CMake package configuration file of BASIS.
#
# @note The @CONFIG_FILE@ file is automatically generated
# by BASIS from the template file Config.cmake.in which is part of the
# BASIS installation.
#
# @ingroup BasisConfig
##############################################################################
# ============================================================================
# namespace
# ============================================================================
@BASIS_NS@
# ----------------------------------------------------------------------------
macro (basis_set_config NAME)
set (${NS}${NAME} ${ARGN})
endmacro ()
# ----------------------------------------------------------------------------
macro (basis_copy_config NAME SRC)
set (${NS}${NAME} ${${NS}${SRC}})
endmacro ()
# ----------------------------------------------------------------------------
macro (basis_append_config NAME)
list (APPEND ${NS}${NAME} ${ARGN})
endmacro ()
# ----------------------------------------------------------------------------
macro (basis_remove_duplicates_config NAME)
if (${NS}${NAME})
list (REMOVE_DUPLICATES ${NS}${NAME})
endif ()
endmacro ()
# ----------------------------------------------------------------------------
macro (basis_is_cached VAR ENTRY)
if (DEFINED ${ENTRY})
get_property (${VAR} CACHE ${ENTRY} PROPERTY TYPE SET)
else ()
set (${VAR} FALSE)
endif ()
endmacro ()
# ----------------------------------------------------------------------------
macro (basis_set_or_update_value VAR)
basis_is_cached (_CACHED ${VAR})
if (_CACHED)
if (ARGC GREATER 1)
set_property (CACHE ${VAR} PROPERTY VALUE ${ARGN})
else ()
set (${VAR} "" CACHE INTERNAL "" FORCE)
endif ()
else ()
set (${VAR} ${ARGN})
endif ()
unset (_CACHED)
endmacro ()
# ============================================================================
# general
# ============================================================================
## @brief Installation prefix or root of build tree.
basis_set_config (INSTALL_PREFIX "@INSTALL_PREFIX_CONFIG@")
get_filename_component (${NS}INSTALL_PREFIX "${${NS}INSTALL_PREFIX}" ABSOLUTE)
## @brief Project use file to be included by other projects.
basis_set_config (USE_FILE "${CMAKE_CURRENT_LIST_DIR}/@USE_FILE@")
## @brief Directory of example files.
basis_set_config (EXAMPLE_DIR "@EXAMPLE_DIR_CONFIG@")
# ============================================================================
# libraries
# ============================================================================
## @brief Directory of header files.
basis_set_config (INCLUDE_DIR "@INCLUDE_DIR_CONFIG@")
## @brief Directory of header files including dependencies.
basis_set_config (INCLUDE_DIRS) # to have a set recognized by Doxygen filter
basis_copy_config (INCLUDE_DIRS INCLUDE_DIR)
basis_append_config (INCLUDE_DIRS "@INCLUDE_DIRS_CONFIG@")
## @brief Directory of libraries.
basis_set_config (LIBRARY_DIR "@LIBRARY_DIR_CONFIG@")
## @brief Directory of libraries including dependencies.
basis_set_config (LIBRARY_DIRS) # to have a set() recognized by Doxygen filter
basis_copy_config (LIBRARY_DIRS LIBRARY_DIR)
basis_append_config (LIBRARY_DIRS "@LIBRARY_DIRS_CONFIG@")
## @brief Search path for Python modules.
basis_set_config (PYTHONPATH "@PYTHONPATH_CONFIG@")
## @brief Search path for Jython modules.
basis_set_config (JYTHONPATH "@JYTHONPATH_CONFIG@")
## @brief Search path for Perl modules.
basis_set_config (PERL5LIB "@PERL5LIB_CONFIG@")
## @brief Search path for MATLAB modules.
basis_set_config (MATLABPATH "@MATLABPATH_CONFIG@")
## @brief Search path for Bash modules.
#
# See the import() function of the BASIS Bash utilities.
basis_set_config (BASHPATH "@BASHPATH_CONFIG@")
# ============================================================================
# exports
# ============================================================================
## @brief Absolute path of exports file to be included by other projects.
basis_set_config (EXPORTS_FILE "${CMAKE_CURRENT_LIST_DIR}/@EXPORTS_FILE@")
## @brief Absolute path of custom exports file to be included by other projects.
basis_set_config (CUSTOM_EXPORTS_FILE "${CMAKE_CURRENT_LIST_DIR}/@CUSTOM_EXPORTS_FILE@")
# ============================================================================
# modules
# ============================================================================
## @brief List of project modules.
basis_set_config (MODULES "@PROJECT_MODULES@")
## @brief List of built project modules.
basis_set_config (MODULES_ENABLED "@PROJECT_MODULES_ENABLED@")
## @brief List of modules requested by external package using the
# @c COMPONENTS argument of
# <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package">
# find_package()</a>.
if (${NS}FIND_COMPONENTS)
basis_set_config (MODULES_REQUESTED "${${NS}FIND_COMPONENTS}")
endif()
if(NOT ${NS}MODULES_REQUESTED)
basis_set_config (MODULES_REQUESTED "${${NS}MODULES_ENABLED}")
endif()
foreach (${NS}MODULE IN LISTS ${NS}MODULES_REQUESTED)
# check if requested module is available
list (FIND ${NS}MODULES_ENABLED ${NS}MODULE IDX)
if (IDX EQUAL -1)
message (FATAL_ERROR "Requested module ${${NS}MODULE} of package @PROJECT_NAME@"
" was not enabled when building @PROJECT_NAME@. Rebuild"
" the @PROJECT_NAME@ package with MODULE_${${NS}MODULE}"
" set to ON and try again.")
endif ()
# include configuration files of modules
set (${${NS}MODULE}_CONFIG_PREFIX "${NS}${MODULE}_")
include ("@MODULES_DIR_CONFIG@/@TOPLEVEL_PROJECT_PACKAGE_CONFIG_PREFIX@${${NS}MODULE}Config.cmake")
unset (${${NS}MODULE}_CONFIG_PREFIX)
# append include directories
if (${NS}${${NS}MODULE}_INCLUDE_DIRS)
basis_append_config (INCLUDE_DIRS ${${NS}${${NS}MODULE}_INCLUDE_DIRS})
elseif (${NS}${M}_INCLUDE_DIR)
basis_append_config (INCLUDE_DIRS ${${NS}${${NS}MODULE}_INCLUDE_DIR})
endif ()
# append library directories
if (${NS}${${NS}MODULE}_LIBRARY_DIRS)
basis_append_config (LIBRARY_DIRS ${${NS}${${NS}MODULE}_LIBRARY_DIRS})
elseif (${NS}${${NS}MODULE}_LIBARY_DIR)
basis_append_config (LIBRARY_DIRS ${${NS}${${NS}MODULE}_LIBRARY_DIR})
endif ()
endforeach ()
unset (${NS}MODULE)
basis_remove_duplicates_config (INCLUDE_DIR)
basis_remove_duplicates_config (INCLUDE_DIRS)
basis_remove_duplicates_config (LIBRARY_DIR)
basis_remove_duplicates_config (LIBRARY_DIRS)
# ============================================================================
# dependencies
# ============================================================================
@DEPENDS_CONFIG@