BASIS  r3148
BASISUse.cmake
Go to the documentation of this file.
00001 ##############################################################################
00002 # @file  BASISUse.cmake
00003 # @brief CMake package configuration use file.
00004 #
00005 # @note The BASISUse.cmake file is automatically generated
00006 #       by BASIS from the template file ConfigUse.cmake.in which is part of
00007 #       the BASIS package.
00008 #
00009 # In the default package use file of BASIS, which can be included here using
00010 # the \@BASIS_USE\@ variable, the prefix used by the package configuration
00011 # file is defined as @c NS variable. Thus, to use any variable set by the
00012 # corresponding package configuration file, use code similar to:
00013 #
00014 # @code
00015 # include_directories (${${NS}INCLUDE_DIRS})
00016 # @endcode
00017 #
00018 # See the ConfigUse.cmake.in file of BASIS for details.
00019 #
00020 # @note The CMake code which is substituted for the \@BASIS_USE\@ variable
00021 #       contains an include guard.
00022 #
00023 # Copyright (c) 2012 University of Pennsylvania. All rights reserved.<br />
00024 # See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
00025 #
00026 # Contact: SBIA Group <sbia-software at uphs.upenn.edu>
00027 #
00028 # @ingroup BasisConfig
00029 ##############################################################################
00030 
00031 # ============================================================================
00032 # namespace
00033 # ============================================================================
00034 
00035 # prefix used for variable names
00036 set (NS "BASIS_")
00037 
00038 # allow caller to change namespace - used by projects with modules
00039 if (${NS}CONFIG_PREFIX)
00040   set (NS "${${NS}CONFIG_PREFIX}")
00041 endif ()
00042 
00043 # ============================================================================
00044 # include guard
00045 # ============================================================================
00046 
00047 if (__${NS}USE_FILE_INCLUDED)
00048   return ()
00049 else ()
00050   set (__${NS}USE_FILE_INCLUDED 1)
00051 endif ()
00052 
00053 # ============================================================================
00054 # use project settings
00055 # ============================================================================
00056 
00057 # include directories
00058 if (${NS}INCLUDE_DIRS)
00059   include_directories (${${NS}INCLUDE_DIRS})
00060 elseif (${NS}INCLUDE_DIR)
00061   include_directories (${${NS}INCLUDE_DIR})
00062 endif ()
00063 
00064 # library directories
00065 if (${NS}LIBRARY_DIRS)
00066   link_directories (${${NS}LIBRARY_DIRS})
00067 elseif (${NS}LIBRARY_DIR)
00068   link_directories (${${NS}LIBRARY_DIR})
00069 endif ()
00070 
00071 # ============================================================================
00072 # import build targets
00073 # ============================================================================
00074 
00075 ## @brief Whether to import the exported targets.
00076 set (NO_${NS}IMPORTS "${NO_${NS}IMPORTS}")
00077 
00078 if (NOT NO_${NS}IMPORTS)
00079   include ("${${NS}EXPORTS_FILE}"        OPTIONAL)
00080   include ("${${NS}CUSTOM_EXPORTS_FILE}" OPTIONAL)
00081 endif ()
00082 
00083 # ============================================================================
00084 # use modules
00085 # ============================================================================
00086 
00087 foreach (M IN LISTS ${NS}MODULES_REQUESTED)
00088   if (${NS}${M}_USE_FILE)
00089     set (${M}_CONFIG_PREFIX "${NS}${M}_")
00090     include ("${${NS}${M}_USE_FILE}")
00091     unset (${M}_CONFIG_PREFIX)
00092   endif ()
00093 endforeach ()
00094 
00095 # ============================================================================
00096 # BASIS configuration
00097 # ============================================================================
00098 
00099 # The following statements ensure that all scripts and modules are
00100 # configured/compiled using the same version of the interpreters.
00101 # Yet, the user can modify these variables, though this is not recommended.
00102 
00103 # Note: The PERL_EXECUTABLE, and BASH_EXECUTABLE variables have to be cached
00104 #       such that the FindPerl.cmake, and FindBASH.cmake modules find the
00105 #       respective executable.
00106 #
00107 # Attention: DO NOT set PYTHON_EXECUTABLE here. In case of a Slicer Extension,
00108 #            the UseSlicer.cmake file requires us not to set PYTHON_EXECUTABLE
00109 #            before including this file. As the BASISUse.cmake file is included
00110 #            before any other dependency, the PYTHON_EXECUTABLE variable is
00111 #            set by the basis_project_impl() macro.
00112 
00113 ## @brief Jython interpreter configured when building BASIS.
00114 if (BASIS_JYTHON_EXECUTABLE)
00115   set (
00116     JYTHON_EXECUTABLE
00117       "${BASIS_JYTHON_EXECUTABLE}"
00118     CACHE PATH
00119       "The Jython interpreter."
00120   )
00121   mark_as_advanced (JYTHON_EXECUTABLE)
00122 endif ()
00123 
00124 ## @brief Perl interpreter configured when building BASIS.
00125 if (BASIS_PERL_EXECUTABLE)
00126   set (
00127     PERL_EXECUTABLE
00128       "${BASIS_PERL_EXECUTABLE}"
00129     CACHE PATH
00130       "The Perl interpreter."
00131   )
00132   mark_as_advanced (PERL_EXECUTABLE)
00133 endif ()
00134 
00135 ## @brief Bash executable configured when building BASIS.
00136 if (BASIS_BASH_EXECUTABLE)
00137   set (
00138     BASH_EXECUTABLE
00139       "${BASIS_BASH_EXECUTABLE}"
00140     CACHE PATH
00141       "The BASH executable."
00142   )
00143   mark_as_advanced (BASH_EXECUTABLE)
00144 endif ()