DirectoriesSettings.cmake
Go to the documentation of this file.
1 # ============================================================================
2 # Copyright (c) 2011-2012 University of Pennsylvania
3 # Copyright (c) 2013-2016 Andreas Schuh
4 # All rights reserved.
5 #
6 # See COPYING file for license information or visit
7 # https://cmake-basis.github.io/download.html#license
8 # ============================================================================
9 
10 ##############################################################################
11 # @file DirectoriesSettings.cmake
12 # @brief CMake variables of project directories.
13 #
14 # This file configures the project directory structure as defined by the
15 # Filesystem Hierarchy Standard for BASIS packages.
16 #
17 # @sa https://cmake-basis.github.io/standard/fhs/
18 #
19 # The project must follow the directory structure as defined by the
20 # <tt>PROJECT_&lt;*&gt;_DIR</tt> variables.
21 #
22 # Ideally, when changing the name of one of these directories, only the
23 # directory structure of the template needs to be updated. The BASIS CMake
24 # functions should not be required to change as they are supposed to use these
25 # variables instead of the actual names. Any change of the project directory
26 # structure has to be made with care, however, and backwards compatibility to
27 # previous releases of BASIS shall be maintained. Consider the use of the
28 # @c TEMPLATE_VERSION if required.
29 #
30 # @note The documentation of the variables can be found in Directories.cmake.in.
31 ##############################################################################
32 
33 
34 # ============================================================================
35 # root directories of top-level project
36 # ============================================================================
37 
38 if (NOT PROJECT_IS_MODULE)
39  set (TOPLEVEL_PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}")
40  set (TOPLEVEL_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}")
41 endif ()
42 
43 # ============================================================================
44 # local variables
45 # ============================================================================
46 
47 if (BUNDLE_NAME AND NOT BUNDLE_NAME MATCHES "${PROJECT_PACKAGE_NAME_RE}")
48  set (_BUNDLE "/${BUNDLE_NAME}")
49 else ()
50  set (_BUNDLE)
51 endif ()
52 if (PROJECT_PACKAGE_VENDOR)
53  set (_VENDOR "/${PROJECT_PACKAGE_VENDOR}")
54 else ()
55  set (_VENDOR)
56 endif ()
57 set (_PACKAGE "/${PROJECT_PACKAGE_NAME}")
58 if (PROJECT_IS_SUBPROJECT)
59  set (_MODULE "/${PROJECT_NAME}")
60 else ()
61  set (_MODULE)
62 endif ()
63 if (UNIX)
64  string (TOLOWER "${_VENDOR}" _VENDOR)
65  string (TOLOWER "${_PACKAGE}" _PACKAGE)
66  string (TOLOWER "${_MODULE}" _MODULE)
67  string (TOLOWER "${_BUNDLE}" _BUNDLE)
68 endif ()
69 
70 # ============================================================================
71 # directories of site packages of script interpreters
72 # ============================================================================
73 
74 # ----------------------------------------------------------------------------
75 set (PYTHON_SITELIB)
76 if (PYTHON_EXECUTABLE)
77  execute_process (
78  COMMAND "${PYTHON_EXECUTABLE}" "${BASIS_MODULE_PATH}/get_python_lib.py"
79  RESULT_VARIABLE _RV
80  OUTPUT_VARIABLE PYTHON_SITELIB
81  OUTPUT_STRIP_TRAILING_WHITESPACE
82  ERROR_QUIET
83  )
84  if (NOT _RV EQUAL 0)
85  set (PYTHON_SITELIB)
86  endif ()
87 endif ()
88 # ----------------------------------------------------------------------------
89 set (JYTHON_SITELIB)
90 if (JYTHON_EXECUTABLE)
91  execute_process (
92  COMMAND "${JYTHON_EXECUTABLE}" "${BASIS_MODULE_PATH}/get_python_lib.py"
93  RESULT_VARIABLE _RV
94  OUTPUT_VARIABLE JYTHON_SITELIB
95  OUTPUT_STRIP_TRAILING_WHITESPACE
96  ERROR_QUIET
97  )
98  if (NOT _RV EQUAL 0)
99  set (JYTHON_SITELIB)
100  endif ()
101 endif ()
102 # ----------------------------------------------------------------------------
103 # Perl
104 find_package (PerlLibs QUIET)
105 if (NOT PerlLibs_FOUND)
106  set (PERL_SITELIB)
107 endif ()
108 
109 # ============================================================================
110 # testing tree
111 # ============================================================================
112 
113 set (TESTING_OUTPUT_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/Temporary${_MODULE}")
114 set (TESTING_RUNTIME_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/bin${_MODULE}")
115 set (TESTING_LIBEXEC_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/lib${_MODULE}")
116 set (TESTING_LIBRARY_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/lib${_MODULE}")
117 set (TESTING_ARCHIVE_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/lib${_MODULE}")
118 
119 foreach (_L IN ITEMS python jython perl matlab bash)
120  string (TOUPPER "${_L}" _U)
121  set (TESTING_${_U}_LIBRARY_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/Testing/lib/${_L}")
122 endforeach ()
123 
124 # ============================================================================
125 # build tree
126 # ============================================================================
127 
128 # set directories corresponding to the source tree directories
129 foreach (_P CODE CONFIG DATA DOC EXAMPLE MODULES TESTING)
130  basis_get_relative_path (_D "${PROJECT_SOURCE_DIR}" "${PROJECT_${_P}_DIR}")
131  set (BINARY_${_P}_DIR "${PROJECT_BINARY_DIR}/${_D}")
132 endforeach ()
133 
134 set (BINARY_INCLUDE_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/include")
135 set (BINARY_RUNTIME_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/bin")
136 set (BINARY_LIBEXEC_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/lib${_MODULE}")
137 set (BINARY_LIBRARY_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/lib${_MODULE}")
138 set (BINARY_ARCHIVE_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/lib${_MODULE}")
139 
140 if (WIN32)
141  set (BINARY_LIBCONF_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/CMake")
142 else ()
143  set (BINARY_LIBCONF_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/lib/cmake${_PACKAGE}")
144 endif ()
145 
146 foreach (_L IN ITEMS python jython perl matlab bash)
147  string (TOUPPER "${_L}" _U)
148  set (BINARY_${_U}_LIBRARY_DIR "${TOPLEVEL_PROJECT_BINARY_DIR}/lib/${_L}")
149 endforeach ()
150 
151 # set default CMake variables which are, however, not used by BASIS
152 set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BINARY_RUNTIME_DIR}")
153 set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BINARY_LIBRARY_DIR}")
154 set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BINARY_ARCHIVE_DIR}")
155 
156 # ============================================================================
157 # install tree
158 # ============================================================================
159 
160 # Attention: In order for CPack to work correctly, the destination paths have
161 # to be given relative to CMAKE_INSTALL_PREFIX. Therefore, this
162 # prefix must be excluded from the following paths!
163 
164 # ----------------------------------------------------------------------------
165 # default installation prefix
166 string (REGEX REPLACE "[\\/]+$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
167 # change default installation prefix used by CMake
168 if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
169  # <ProgramFilesDir>/<Vendor>/<Package>[-<version>]
170  if (WIN32)
171  get_filename_component (CMAKE_INSTALL_PREFIX "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion;ProgramFilesDir]" ABSOLUTE)
172  if (NOT CMAKE_INSTALL_PREFIX OR CMAKE_INSTALL_PREFIX MATCHES "/registry")
173  set (CMAKE_INSTALL_PREFIX "C:/Program Files")
174  endif ()
175  set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}${_VENDOR}${_PACKAGE}")
176  if (NOT PROJECT_VERSION MATCHES "^0\\.0\\.0$")
177  set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}-${PROJECT_VERSION}")
178  endif ()
179  # /opt/<vendor>/<package>[-<version>]
180  else ()
181  set (CMAKE_INSTALL_PREFIX "/opt${_VENDOR}${_PACKAGE}")
182  if (NOT PROJECT_VERSION MATCHES "^0\\.0\\.0$")
183  set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}-${PROJECT_VERSION}")
184  endif ()
185  endif ()
186 endif ()
187 set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Installation prefix." FORCE)
188 
189 # ----------------------------------------------------------------------------
190 # installation scheme - non-cached, can be preset using -D option of CMake
191 set (BASIS_INSTALL_SCHEME "default" CACHE STRING "default, opt, usr, win")
192 set_property(CACHE BASIS_INSTALL_SCHEME PROPERTY STRINGS default opt usr win)
193 mark_as_advanced (BASIS_INSTALL_SCHEME)
194 
195 if (BASIS_INSTALL_SCHEME MATCHES "default")
196  string (TOLOWER "${CMAKE_INSTALL_PREFIX}" _CMAKE_INSTALL_PREFIX_L)
197  basis_sanitize_for_regex (_BUNDLE_NAME_RE "${BUNDLE_NAME}")
198  string (TOLOWER "{_BUNDLE_NAME_RE}" _BUNDLE_NAME_RE_L)
199  string (TOUPPER "{_BUNDLE_NAME_RE}" _BUNDLE_NAME_RE_U)
200  if (WIN32)
201  set (BASIS_INSTALL_SCHEME win)
202  elseif (NOT _BUNDLE AND _CMAKE_INSTALL_PREFIX_L MATCHES "/(.*[_-])?(${PROJECT_PACKAGE_NAME_RE}|${PROJECT_PACKAGE_NAME_RE_L}|${PROJECT_PACKAGE_NAME_RE_U})[_-]?") # e.g. /opt/<package>[-<version>]
203  set (BASIS_INSTALL_SCHEME opt)
204  elseif (_BUNDLE AND _CMAKE_INSTALL_PREFIX_L MATCHES "/(.*[_-])?(${_BUNDLE_NAME_RE}|${_BUNDLE_NAME_RE_L}|${_BUNDLE_NAME_RE_U})[_-]?") # e.g. /opt/<bundle>[-<version>]
205  set (BASIS_INSTALL_SCHEME opt)
206  else ()
207  set (BASIS_INSTALL_SCHEME usr)
208  endif ()
209  unset (_CMAKE_INSTALL_PREFIX_L)
210  unset (_BUNDLE_NAME_RE)
211  unset (_BUNDLE_NAME_RE_L)
212  unset (_BUNDLE_NAME_RE_U)
213 endif ()
214 
215 if (NOT BASIS_INSTALL_SCHEME MATCHES "^(opt|usr|win|bundle)$")
216  message (FATAL_ERROR "Invalid BASIS_INSTALL_SCHEME! Valid values are 'default', 'opt', 'usr', 'win'.")
217 endif ()
218 
219 # ----------------------------------------------------------------------------
220 # installation directories
221 if (BASIS_INSTALL_SCHEME MATCHES "win") # e.g., CMAKE_INSTALL_PREFIX := <ProgramFilesDir>/<Vendor>/<Package>
222 
223  # --------------------------------------------------------------------------
224  # bundled dependency
225  if (_BUNDLE)
226  # package configuration
227  set (INSTALL_CONFIG_DIR "CMake")
228  # executables
229  set (INSTALL_RUNTIME_DIR "Lib${_PACKAGE}${_MODULE}")
230  set (INSTALL_LIBEXEC_DIR "Lib${_PACKAGE}${_MODULE}")
231  # libraries
232  set (INSTALL_INCLUDE_DIR "Include")
233  set (INSTALL_LIBRARY_DIR "Lib${_PACKAGE}${_MODULE}")
234  set (INSTALL_ARCHIVE_DIR "Lib${_PACKAGE}${_MODULE}")
235  # shared data
236  set (INSTALL_SHARE_DIR "Share${_PACKAGE}${_MODULE}")
237  set (INSTALL_DATA_DIR "Data${_PACKAGE}${_MODULE}")
238  set (INSTALL_EXAMPLE_DIR "Example${_PACKAGE}${_MODULE}")
239  # documentation
240  set (INSTALL_DOC_DIR "Doc${_PACKAGE}${_MODULE}")
241  set (INSTALL_MAN_DIR)
242  set (INSTALL_TEXINFO_DIR)
243  # --------------------------------------------------------------------------
244  # main package
245  else ()
246  # package configuration
247  set (INSTALL_CONFIG_DIR "CMake")
248  # executables
249  set (INSTALL_RUNTIME_DIR "Bin")
250  set (INSTALL_LIBEXEC_DIR "Lib${_MODULE}")
251  # libraries
252  set (INSTALL_INCLUDE_DIR "Include")
253  set (INSTALL_LIBRARY_DIR "Lib${_MODULE}")
254  set (INSTALL_ARCHIVE_DIR "Lib${_MODULE}")
255  # shared data
256  set (INSTALL_SHARE_DIR "Share${_MODULE}")
257  set (INSTALL_DATA_DIR "Data${_MODULE}")
258  set (INSTALL_EXAMPLE_DIR "Example${_MODULE}")
259  # documentation
260  set (INSTALL_DOC_DIR "Doc${_MODULE}")
261  set (INSTALL_MAN_DIR)
262  set (INSTALL_TEXINFO_DIR)
263  endif ()
264 
265 elseif (BASIS_INSTALL_SCHEME MATCHES "usr") # e.g., CMAKE_INSTALL_PREFIX := /usr/local
266 
267  # --------------------------------------------------------------------------
268  # bundled dependency
269  if (_BUNDLE)
270  # package configuration
271  set (INSTALL_CONFIG_DIR "lib/cmake${_BUNDLE}")
272  # executables
273  set (INSTALL_RUNTIME_DIR "lib${_BUNDLE}${_PACKAGE}${_MODULE}")
274  set (INSTALL_LIBEXEC_DIR "lib${_BUNDLE}${_PACKAGE}${_MODULE}")
275  # libraries
276  set (INSTALL_INCLUDE_DIR "include")
277  set (INSTALL_LIBRARY_DIR "lib${_BUNDLE}${_PACKAGE}${_MODULE}")
278  set (INSTALL_ARCHIVE_DIR "lib${_BUNDLE}${_PACKAGE}${_MODULE}")
279  # shared data
280  set (INSTALL_SHARE_DIR "share${_BUNDLE}${_PACKAGE}${_MODULE}")
281  set (INSTALL_DATA_DIR "share${_BUNDLE}${_PACKAGE}${_MODULE}/data")
282  set (INSTALL_EXAMPLE_DIR "share${_BUNDLE}${_PACKAGE}${_MODULE}/example")
283  # documentation
284  set (INSTALL_DOC_DIR "doc${_BUNDLE}${_PACKAGE}${_MODULE}")
285  set (INSTALL_MAN_DIR "share${_BUNDLE}${_PACKAGE}${_MODULE}/man")
286  set (INSTALL_TEXINFO_DIR "share${_BUNDLE}${_PACKAGE}${_MODULE}/info")
287  # --------------------------------------------------------------------------
288  # main package
289  else ()
290  # package configuration
291  set (INSTALL_CONFIG_DIR "lib/cmake${_PACKAGE}")
292  # executables
293  set (INSTALL_RUNTIME_DIR "bin")
294  set (INSTALL_LIBEXEC_DIR "lib${_PACKAGE}${_MODULE}")
295  # libraries
296  set (INSTALL_INCLUDE_DIR "include")
297  set (INSTALL_LIBRARY_DIR "lib${_PACKAGE}${_MODULE}")
298  set (INSTALL_ARCHIVE_DIR "lib${_PACKAGE}${_MODULE}")
299  # shared data
300  set (INSTALL_SHARE_DIR "share${_PACKAGE}${_MODULE}")
301  set (INSTALL_DATA_DIR "share${_PACKAGE}${_MODULE}/data")
302  set (INSTALL_EXAMPLE_DIR "share${_PACKAGE}${_MODULE}/example")
303  # documentation
304  set (INSTALL_DOC_DIR "doc${_PACKAGE}${_MODULE}")
305  set (INSTALL_MAN_DIR "share/man")
306  set (INSTALL_TEXINFO_DIR "share/info")
307  endif ()
308 
309 else () # e.g., CMAKE_INSTALL_PREFIX := /opt/<vendor>/<package>
310 
311  # --------------------------------------------------------------------------
312  # bundled dependency
313  if (_BUNDLE)
314  # package configuration
315  set (INSTALL_CONFIG_DIR "lib/cmake${_BUNDLE}")
316  # executables
317  set (INSTALL_RUNTIME_DIR "lib${_PACKAGE}${_MODULE}")
318  set (INSTALL_LIBEXEC_DIR "lib${_PACKAGE}${_MODULE}")
319  # libraries
320  set (INSTALL_INCLUDE_DIR "include")
321  set (INSTALL_LIBRARY_DIR "lib${_PACKAGE}${_MODULE}")
322  set (INSTALL_ARCHIVE_DIR "lib${_PACKAGE}${_MODULE}")
323  # shared data
324  set (INSTALL_SHARE_DIR "share${_PACKAGE}${_MODULE}")
325  set (INSTALL_DATA_DIR "share${_PACKAGE}${_MODULE}/data")
326  set (INSTALL_EXAMPLE_DIR "share${_PACKAGE}${_MODULE}/example")
327  # documentation
328  set (INSTALL_DOC_DIR "doc${_PACKAGE}${_MODULE}")
329  set (INSTALL_MAN_DIR "share${_PACKAGE}${_MODULE}/man")
330  set (INSTALL_TEXINFO_DIR "share${_PACKAGE}${_MODULE}/info")
331  else ()
332  # package configuration
333  set (INSTALL_CONFIG_DIR "lib/cmake${_PACKAGE}")
334  # executables
335  set (INSTALL_RUNTIME_DIR "bin")
336  set (INSTALL_LIBEXEC_DIR "lib${_MODULE}")
337  # libraries
338  set (INSTALL_INCLUDE_DIR "include")
339  set (INSTALL_LIBRARY_DIR "lib${_MODULE}")
340  set (INSTALL_ARCHIVE_DIR "lib${_MODULE}")
341  # shared data
342  set (INSTALL_SHARE_DIR "share${_MODULE}")
343  set (INSTALL_DATA_DIR "share${_MODULE}/data")
344  set (INSTALL_EXAMPLE_DIR "share${_MODULE}/example")
345  # documentation
346  set (INSTALL_DOC_DIR "doc${_MODULE}")
347  set (INSTALL_MAN_DIR "man")
348  set (INSTALL_TEXINFO_DIR "info")
349  endif ()
350 
351 endif ()
352 
353 # ----------------------------------------------------------------------------
354 # private script libraries
355 #
356 # The modules of script libraries which are only intended for use by this
357 # package itself are installed within the package own installation
358 # prefix/subdirectories.
359 if (BASIS_INSTALL_SCHEME MATCHES "win")
360 
361  foreach (_L IN ITEMS Python Jython Perl Matlab Bash)
362  string (TOUPPER "${_L}" _U)
363  if (BASIS_COMPILE_SCRIPTS)
364  if (_U MATCHES "PERL")
365  set (INSTALL_${_U}_LIBRARY_DIR "Lib/Perl5")
366  elseif (NOT _U MATCHES "MATLAB|BASH" AND ${_U}_VERSION_MAJOR AND DEFINED ${_U}_VERSION_MINOR)
367  set (INSTALL_${_U}_LIBRARY_DIR "Lib/${_L}${${_U}_VERSION_MAJOR}.${${_U}_VERSION_MINOR}")
368  else ()
369  set (INSTALL_${_U}_LIBRARY_DIR "Lib/${_L}")
370  endif ()
371  else ()
372  set (INSTALL_${_U}_LIBRARY_DIR "Lib/${_L}")
373  endif ()
374  endforeach ()
375 
376 elseif (BASIS_INSTALL_SCHEME MATCHES "usr")
377 
378  if (_BUNDLE)
379  set (_P "${_BUNDLE}")
380  else ()
381  set (_P "${_PACKAGE}")
382  endif ()
383 
384  foreach (_L IN ITEMS python jython perl matlab bash)
385  string (TOUPPER "${_L}" _U)
386  if (BASIS_COMPILE_SCRIPTS)
387  if (_U MATCHES "PERL")
388  set (INSTALL_${_U}_LIBRARY_DIR "lib${_P}/perl5")
389  elseif (NOT _U MATCHES "MATLAB|BASH" AND ${_U}_VERSION_MAJOR AND DEFINED ${_U}_VERSION_MINOR)
390  set (INSTALL_${_U}_LIBRARY_DIR "lib${_P}/${_L}${${_U}_VERSION_MAJOR}.${${_U}_VERSION_MINOR}")
391  else ()
392  set (INSTALL_${_U}_LIBRARY_DIR "lib${_P}/${_L}")
393  endif ()
394  else ()
395  set (INSTALL_${_U}_LIBRARY_DIR "lib${_P}/${_L}")
396  endif ()
397  endforeach ()
398 
399 else () # opt
400 
401  foreach (_L IN ITEMS python jython perl matlab bash)
402  string (TOUPPER "${_L}" _U)
403  if (BASIS_COMPILE_SCRIPTS)
404  if (_U MATCHES "PERL")
405  set (INSTALL_${_U}_LIBRARY_DIR "lib/perl5")
406  elseif (NOT _U MATCHES "MATLAB|BASH" AND ${_U}_VERSION_MAJOR AND DEFINED ${_U}_VERSION_MINOR)
407  set (INSTALL_${_U}_LIBRARY_DIR "lib/${_L}${${_U}_VERSION_MAJOR}.${${_U}_VERSION_MINOR}")
408  else ()
409  set (INSTALL_${_U}_LIBRARY_DIR "lib/${_L}")
410  endif ()
411  else ()
412  set (INSTALL_${_U}_LIBRARY_DIR "lib/${_L}")
413  endif ()
414  endforeach ()
415 
416 endif ()
417 
418 # ----------------------------------------------------------------------------
419 # public script libraries
420 #
421 # The modules of script libraries which are intended for use by external packages
422 # are installed in the respective installation directories of the particular
423 # interpreter. For example, in case of Python, the public Python modules are
424 # installed in the site-packages directory of the found PYTHON_EXECUTABLE.
425 # In particular the modules in the PROJECT_LIBRARY_DIR are intended for use
426 # by external packages. Other modules added using the basis_add_script_library()
427 # and basis_add_script() CMake functions are by default considered to be intended
428 # for internal use by the other modules and executable scripts.
429 #
430 # Note: For those interpreters of scripting languages which by themselves do
431 # not define a common installation directory for site packages, the
432 # installation directory for public modules may be identical to the
433 # one for private modules. Moreover, the user has the option to disable
434 # the installation of public modules in the system default site directories
435 # in order to prevent the installation of files outside the CMAKE_INSTALL_PREFIX.
436 
437 # reset directories if BASIS_INSTALL_SITE_PACKAGES option has been changed
438 if (DEFINED _BASIS_INSTALL_SITE_PACKAGES)
439  set (_RESET FALSE)
440  if (BASIS_INSTALL_SITE_PACKAGES AND NOT _BASIS_INSTALL_SITE_PACKAGES)
441  set (_RESET TRUE)
442  elseif (NOT BASIS_INSTALL_SITE_PACKAGES AND _BASIS_INSTALL_SITE_PACKAGES)
443  set (_RESET TRUE)
444  endif ()
445  if (_RESET)
446  foreach (_L IN ITEMS PYTHON JYTHON PERL)
447  # do not reset if BASIS_INSTALL_SITE_PACKAGES is OFF and path is already relative
448  if (IS_ABSOLUTE "${INSTALL_${_L}_SITE_DIR}" OR BASIS_INSTALL_SITE_PACKAGES)
449  basis_update_value (INSTALL_${_L}_SITE_DIR)
450  endif ()
451  endforeach ()
452  endif ()
453  unset (_RESET)
454 endif ()
455 set (_BASIS_INSTALL_SITE_PACKAGES "${BASIS_INSTALL_SITE_PACKAGES}" CACHE INTERNAL "Previous value of BASIS_INSTALL_SITE_PACKAGES option." FORCE)
456 
457 # try to determine default installation directories
458 if (BASIS_INSTALL_SITE_PACKAGES)
459  # Python
460  if (NOT INSTALL_PYTHON_SITE_DIR)
461  set (INSTALL_PYTHON_SITE_DIR "${PYTHON_SITELIB}")
462  endif ()
463  # Jython
464  if (NOT INSTALL_JYTHON_SITE_DIR)
465  set (INSTALL_JYTHON_SITE_DIR "${JYTHON_SITELIB}")
466  endif ()
467  # Perl
468  if (NOT INSTALL_PERL_SITE_DIR)
469  set (INSTALL_PERL_SITE_DIR "${PERL_SITELIB}")
470  endif ()
471 endif ()
472 
473 # if it failed to determine the default installation directories by executing some
474 # code or command, use the directories used for private libraries instead
475 foreach (_U IN ITEMS PYTHON JYTHON PERL MATLAB BASH)
476  if (NOT INSTALL_${_U}_SITE_DIR)
477  set (INSTALL_${_U}_SITE_DIR "${INSTALL_${_U}_LIBRARY_DIR}")
478  endif ()
479 endforeach ()
480 
481 # cache directories - also so users can edit them
482 foreach (_L IN ITEMS Python Jython Perl MATLAB Bash)
483  string (TOUPPER "${_L}" _U)
484  set (INSTALL_${_U}_SITE_DIR "${INSTALL_${_U}_SITE_DIR}" CACHE PATH "Installation directory for public ${_L} modules." FORCE)
485  mark_as_advanced (INSTALL_${_U}_SITE_DIR)
486 endforeach ()
487 
488 # ============================================================================
489 # top-level references
490 # ============================================================================
491 
492 if (NOT PROJECT_IS_MODULE)
493  # source tree
494  foreach (_D CODE CONFIG DATA DOC EXAMPLE INCLUDE MODULES TESTING)
495  set (TOPLEVEL_PROJECT_${_D}_DIR "${PROJECT_${_D}_DIR}")
496  endforeach ()
497  # build tree
498  foreach (_D CODE CONFIG DATA DOC EXAMPLE INCLUDE MODULES TESTING RUNTIME LIBEXEC LIBRARY ARCHIVE LIBCONF)
499  set (TOPLEVEL_BINARY_${_D}_DIR "${BINARY_${_D}_DIR}")
500  endforeach ()
501  foreach (_L IN ITEMS PYTHON JYTHON PERL MATLAB BASH)
502  set (TOPLEVEL_BINARY_${_L}_LIBRARY_DIR "${BINARY_${_L}_LIBRARY_DIR}")
503  endforeach ()
504  # installation
505  foreach (_D IN ITEMS CONFIG INCLUDE RUNTIME LIBEXEC LIBRARY ARCHIVE DATA DOC EXAMPLE SHARE)
506  set (TOPLEVEL_INSTALL_${_D}_DIR "${INSTALL_${_D}_DIR}")
507  endforeach ()
508  foreach (_L IN ITEMS PYTHON JYTHON PERL MATLAB BASH)
509  set (TOPLEVEL_INSTALL_${_L}_LIBRARY_DIR "${INSTALL_${_L}_LIBRARY_DIR}")
510  endforeach ()
511 endif ()
512 
513 # ============================================================================
514 # clean up
515 # ============================================================================
516 
517 unset (_D)
518 unset (_L)
519 unset (_U)
520 unset (_P)
521 unset (_RV)
522 unset (_VENDOR)
523 unset (_PACKAGE)
524 unset (_MODULE)
525 unset (_DEFAULT_SCHEME)
526 
527 
528 ## @}
529 # end of Doxygen group
cmake _PACKAGE
cmake TESTING_LIBEXEC_DIR
cmake _MODULE
cmake BINARY_LIBEXEC_DIR
cmake BINARY_LIBRARY_DIR
cmake PERL_SITELIB
Default directory for Perl site packages.
function basis_get_relative_path(out REL, in BASE, in PATH)
Get path relative to a given base directory.
cmake CMAKE_RUNTIME_OUTPUT_DIRECTORY
option BASIS_INSTALL_SITE_PACKAGES
Enable the installation of scripted modules in site specific default directories. ...
cmake BASIS_INSTALL_SCHEME
cmake CMAKE_LIBRARY_OUTPUT_DIRECTORY
cmake BINARY_ARCHIVE_DIR
cmake TOPLEVEL_PROJECT_SOURCE_DIR
cmake PYTHON_SITELIB
Default directory for Python site packages.
cmake BINARY_LIBCONF_DIR
cmake TESTING_RUNTIME_DIR
cmake JYTHON_SITELIB
Default directory for Jython site packages.
cmake BINARY_RUNTIME_DIR
cmake TESTING_ARCHIVE_DIR
cmake BINARY_INCLUDE_DIR
cmake TESTING_LIBRARY_DIR
cmake CMAKE_INSTALL_PREFIX
#define UNIX
Whether the sources are compiled on a Unix-based system.
Definition: config.h:60
cmake COMMAND
cmake TESTING_OUTPUT_DIR
cmake CMAKE_ARCHIVE_OUTPUT_DIRECTORY
cmake TOPLEVEL_PROJECT_BINARY_DIR
cmake _BUNDLE
cmake _VENDOR
macro find_package()
Overloaded find_package() command.
cmake PerlLibs_FOUND
function get_filename_component(inout ARGN)
Fixes CMake&#39;s get_filename_component() command.