MIRTKUse.cmake
1 ##############################################################################
2 # @file MIRTKUse.cmake
3 # @brief CMake package configuration use file.
4 #
5 # @note The MIRTKUse.cmake file is automatically generated
6 # by BASIS from the template file ConfigUse.cmake.in which is part of the
7 # BASIS installation.
8 #
9 # @ingroup BasisConfig
10 ##############################################################################
11 
12 # ============================================================================
13 # namespace
14 # ============================================================================
15 
16 # prefix used for variable names
17 set (NS "MIRTK_")
18 
19 # allow caller to change namespace - used by projects with modules
20 if (${NS}CONFIG_PREFIX)
21  set (NS "${${NS}CONFIG_PREFIX}_")
22 endif ()
23 
24 # ============================================================================
25 # include guard
26 # ============================================================================
27 
28 if (__${NS}USE_FILE_INCLUDED)
29  return ()
30 else ()
31  set (__${NS}USE_FILE_INCLUDED 1)
32 endif ()
33 
34 # ============================================================================
35 # use project settings
36 # ============================================================================
37 
38 # include directories
39 if (${NS}INCLUDE_DIRS)
40  include_directories (${${NS}INCLUDE_DIRS})
41 elseif (${NS}INCLUDE_DIR)
42  include_directories (${${NS}INCLUDE_DIR})
43 endif ()
44 
45 # library directories
46 if (${NS}LIBRARY_DIRS)
47  link_directories (${${NS}LIBRARY_DIRS})
48 elseif (${NS}LIBRARY_DIR)
49  link_directories (${${NS}LIBRARY_DIR})
50 endif ()
51 
52 # ============================================================================
53 # import build targets
54 # ============================================================================
55 
56 ## @brief Whether to import the exported targets.
57 set (NO_${NS}IMPORTS "${NO_${NS}IMPORTS}")
58 
59 if (NOT NO_${NS}IMPORTS)
60  include ("${${NS}EXPORTS_FILE}" OPTIONAL)
61  include ("${${NS}CUSTOM_EXPORTS_FILE}" OPTIONAL)
62 endif ()
63 
64 # ============================================================================
65 # use modules
66 # ============================================================================
67 
68 foreach (M IN LISTS ${NS}MODULES_REQUESTED)
69  if (${NS}${M}_USE_FILE)
70  set (${M}_CONFIG_PREFIX "${NS}${M}_")
71  include ("${${NS}${M}_USE_FILE}")
72  unset (${M}_CONFIG_PREFIX)
73  endif ()
74 endforeach ()