BASIS  version 1.2.3 (revision 2104)
ProjectSettings.cmake
Go to the documentation of this file.
00001 ##############################################################################
00002 # @file  ProjectSettings.cmake
00003 # @brief Default project-dependent settings.
00004 #
00005 # @note The file ProjectSettings.cmake is automatically generated by
00006 #       BASIS from the template file ProjectSettings.cmake.in which is part
00007 #       of the BASIS installation.
00008 #
00009 # @note More general, project-independent settings are defined in the file
00010 #       CommonSettings.cmake which is part of the BASIS installation.
00011 #
00012 # This module defines global CMake constants and variables which are used
00013 # by the BASIS CMake functions and macros. Hence, these values can be used
00014 # to configure the behavior of these functions to some extent without the
00015 # need to modify the functions themselves.
00016 #
00017 # @attention Be careful when caching any of the variables. Usually, this
00018 #            file is included in the root CMake configuration file of the
00019 #            project which may also be a module of another project and hence
00020 #            may overwrite this project's settings. For project-wide variables
00021 #            which are modified by the BASIS functions consider the use of
00022 #            so-called project properties as implemented by the BASIS functions
00023 #            basis_set_project_property() and basis_get_project_property().
00024 #
00025 # Variables in this file which are only set if not set previously, i.e.,
00026 # by using basis_set_if_empty(), are set when this file is included the first
00027 # time by a project, but not changed when it is included by a module of this
00028 # project. This is important in order to merge the module's output files with
00029 # the files of the project it is part of.
00030 #
00031 # Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.<br />
00032 # See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
00033 #
00034 # Contact: SBIA Group <sbia-software at uphs.upenn.edu>
00035 #
00036 # @ingroup BasisSettings
00037 ##############################################################################
00038 
00039 ## @addtogroup BasisSettings
00040 # @{
00041 
00042 
00043 # ============================================================================
00044 # options
00045 # ============================================================================
00046 
00047 ## @brief Request build/installation of documentation.
00048 if (EXISTS "${PROJECT_DOC_DIR}")
00049   option (BUILD_DOCUMENTATION "Request build and/or installation of documentation." ON)
00050 endif ()
00051 
00052 ## @brief Request build/installation of example.
00053 if (EXISTS ${PROJECT_EXAMPLE_DIR})
00054   option (BUILD_EXAMPLE "Request build and/or installation of example." ON)
00055 endif ()
00056 
00057 # ============================================================================
00058 # project namespaces
00059 # ============================================================================
00060 
00061 ## @brief Whether BASIS shall use fully-qualified target UIDs.
00062 #
00063 # If this option is OFF, the namespace of the top-level BASIS project is
00064 # not prepended to the actual CMake build target names.
00065 #
00066 # For example, instead of the fully-qualified target UID
00067 # "sbia.basis.target", the CMake target name will simply
00068 # be "target". Only when the target is referenced from another project,
00069 # the fully-qualified target UID is usually required.
00070 basis_set_if_empty (BASIS_USE_FULLY_QUALIFIED_UIDS OFF)
00071 
00072 ## @brief Whether BASIS should use a separate namespace for each module.
00073 #
00074 # If this option is ON, BASIS will use a separate namespace for each module.
00075 # Otherwise, all modules of a project reside dirctly in the namespace of the
00076 # top-level project itself.
00077 basis_set_if_empty (BASIS_USE_MODULE_NAMESPACES OFF)
00078 
00079 ## @brief Global namespace of BASIS projects.
00080 if (NOT DEFINED BASIS_NAMESPACE)
00081   set (BASIS_NAMESPACE "SBIA")
00082 endif ()
00083 string (TOLOWER "${BASIS_NAMESPACE}" BASIS_NAMESPACE_LOWER)
00084 string (TOUPPER "${BASIS_NAMESPACE}" BASIS_NAMESPACE_UPPER)
00085 
00086 ## @brief CMake namespace of top-level project.
00087 #
00088 # This is the common namespace of a BASIS project and its modules.
00089 # It is the part of the namespace which is only required if the project's
00090 # targets are referenced from another project, but not within the project.
00091 if (NOT PROJECT_IS_MODULE)
00092   if (BASIS_NAMESPACE)
00093     set (BASIS_PROJECT_NAMESPACE_CMAKE "${BASIS_NAMESPACE_LOWER}.basis")
00094   else ()
00095     set (BASIS_PROJECT_NAMESPACE_CMAKE "basis")
00096   endif ()
00097 endif ()
00098 basis_sanitize_for_regex (
00099   BASIS_PROJECT_NAMESPACE_CMAKE_REGEX "${BASIS_PROJECT_NAMESPACE_CMAKE}"
00100 )
00101 
00102 ## @brief CMake namespace of project.
00103 #
00104 # The CMake namespace of a BASIS project is made up of its name in lower case
00105 # only as well as the namespace the project belongs to, i.e., the namespace of
00106 # the project this project is a module of.
00107 #
00108 # Example:
00109 # @code
00110 # basis_make_target_uid(TARGET_UID "mycmd")
00111 # # sets TARGET_UID to "sbia.basis.mycmd"
00112 # @endcode
00113 #
00114 # @sa basis_make_target_uid()
00115 # @sa basis_get_target_uid()
00116 # @sa basis_make_test_uid()
00117 # @sa basis_get_test_uid()
00118 if (NOT PROJECT_IS_MODULE)
00119   set (PROJECT_NAMESPACE_CMAKE "${BASIS_PROJECT_NAMESPACE_CMAKE}")
00120 else ()
00121   if (BASIS_USE_MODULE_NAMESPACES)
00122     set (PROJECT_NAMESPACE_CMAKE "${PROJECT_NAMESPACE_CMAKE}.basis")
00123   endif ()
00124 endif ()
00125 basis_sanitize_for_regex (PROJECT_NAMESPACE_CMAKE_REGEX "${PROJECT_NAMESPACE_CMAKE}")
00126 
00127 ## @brief CMake variable of C++ namespace of project.
00128 #
00129 # The C++ namespace of a BASIS project is made up of its name in lower case
00130 # only as well as the namespace the project belongs to, i.e., the namespace of
00131 # the project this project is a module of.
00132 #
00133 # Example:
00134 # @code
00135 # namespace sbia {
00136 # namespace basis {
00137 # // your code goes here
00138 # }
00139 # }
00140 # @endcode
00141 #
00142 # @ingroup BasisCxxUtilities
00143 if (NOT PROJECT_IS_MODULE)
00144   if (BASIS_NAMESPACE)
00145     set (PROJECT_NAMESPACE_CXX "${BASIS_NAMESPACE_LOWER}::basis")
00146   else ()
00147     set (PROJECT_NAMESPACE_CXX "basis")
00148   endif ()
00149 else ()
00150   if (BASIS_USE_MODULE_NAMESPACES)
00151     set (PROJECT_NAMESPACE_CXX "${PROJECT_NAMESPACE_CXX}::basis")
00152   endif ()
00153 endif ()
00154 
00155 ## @brief CMake variable of Java package name of project.
00156 #
00157 # The Java package name of a BASIS project is made up of its name in lower case
00158 # only as well as the package name of the project it belongs to.
00159 #
00160 # Example:
00161 # @code
00162 # package sbia.basis;
00163 # @endcode
00164 #
00165 # @ingroup BasisJavaUtilities
00166 if (NOT PROJECT_IS_MODULE)
00167   if (BASIS_NAMESPACE)
00168     set (PROJECT_NAMESPACE_JAVA "${BASIS_NAMESPACE_LOWER}.basis")
00169   else ()
00170     set (PROJECT_NAMESPACE_JAVA "basis")
00171   endif ()
00172 else ()
00173   if (BASIS_USE_MODULE_NAMESPACES)
00174     set (PROJECT_NAMESPACE_JAVA "${PROJECT_NAMESPACE_JAVA}.basis")
00175   endif ()
00176 endif ()
00177 
00178 ## @brief CMake variable of Python package name of project.
00179 #
00180 # The Python package name of a BASIS project is made up of its name in lower case
00181 # only as well as the package name of the project it belongs to.
00182 #
00183 # Example:
00184 # @code
00185 # import sbia.basis
00186 # @endcode
00187 #
00188 # @ingroup BasisPythonUtilities
00189 if (NOT PROJECT_IS_MODULE)
00190   if (BASIS_NAMESPACE)
00191     set (PROJECT_NAMESPACE_PYTHON "${BASIS_NAMESPACE_LOWER}.basis")
00192   else ()
00193     set (PROJECT_NAMESPACE_PYTHON "basis")
00194   endif ()
00195 else ()
00196   if (BASIS_USE_MODULE_NAMESPACES)
00197     set (PROJECT_NAMESPACE_PYTHON "${PROJECT_NAMESPACE_PYTHON}.basis")
00198   endif ()
00199 endif ()
00200 
00201 ## @brief CMake variable of Perl package name of project.
00202 #
00203 # The Perl package name of a BASIS project is made up of the project name which
00204 # must be either all capital letters or mixed case starting with a captital letter.
00205 # Note that Perl informally reserves lowercase module names for "pragma" modules
00206 # such as <tt>integer</tt> and <tt>strict</tt>.
00207 #
00208 # Example:
00209 # @code
00210 # package SBIA::BASIS;
00211 # @endcode
00212 #
00213 # @ingroup BasisPerlUtilities
00214 if (NOT PROJECT_IS_MODULE)
00215   if (BASIS_NAMESPACE)
00216     set (PROJECT_NAMESPACE_PERL "${BASIS_NAMESPACE}::BASIS")
00217   else ()
00218     set (PROJECT_NAMESPACE_PERL "BASIS")
00219   endif ()
00220 else ()
00221   if (BASIS_USE_MODULE_NAMESPACES)
00222     set (PROJECT_NAMESPACE_PERL "${PROJECT_NAMESPACE_PERL}::BASIS")
00223   endif ()
00224 endif ()
00225 
00226 ## @brief CMake variable of BASH namespace of project.
00227 #
00228 # In BASH, there exists no such concept of a namespace or package. However,
00229 # variable and function names defined in a module which is supposed to be
00230 # sourced by other BASH scripts should use a unique prefix for variable and
00231 # function names.
00232 #
00233 # The BASH module namespace of a BASIS project is made up of its name in upper
00234 # case only to distinguish it from the actual variable or function name as well
00235 # as the namespace of the project it belongs to.
00236 #
00237 # Example:
00238 # @code
00239 # # The project's namespace is SBIA_BASIS and the name of the
00240 # # module in this example is mymodule.sh. This gives the fully-qualified module
00241 # # namespace SBIA_BASIS_MYMODULE. Note that private identifiers
00242 # # are further
00243 # # prefixed with an underscore '_'.
00244 #
00245 # # return if already loaded
00246 # [ "${_SBIA_BASIS_MYMODULE_INCLUDED:-0}" -eq 1 ] && return 0
00247 # _SBIA_BASIS_MYMODULE_INCLUDED=1
00248 #
00249 # # define private global variable
00250 # _SBIA_BASIS_MYMODULE_verbose=0
00251 #
00252 # # define public function
00253 # #
00254 # # Note: To not complicate the use of the module, the name must not necessarily
00255 # #       include the fully-qualified namespace identifier, but the name should
00256 # #       chosen carefully to avoid name conflicts with other modules.
00257 # MYMODULE_string()
00258 # {
00259 #     # ...
00260 # }
00261 # @endcode
00262 #
00263 # @ingroup BasisBashUtilities
00264 if (NOT PROJECT_IS_MODULE)
00265   if (BASIS_NAMESPACE)
00266     set (PROJECT_NAMESPACE_BASH "${BASIS_NAMESPACE_UPPER}_BASIS")
00267   else ()
00268     set (PROJECT_NAMESPACE_BASH "BASIS")
00269   endif ()
00270 else ()
00271   if (BASIS_USE_MODULE_NAMESPACES)
00272     set (PROJECT_NAMESPACE_BASH "${PROJECT_NAMESPACE_BASH}_BASIS")
00273   endif ()
00274 endif ()
00275 
00276 ## @brief CMake variable of MATLAB package name of project.
00277 #
00278 # The MATLAB package name of a BASIS project is made up of its name in lower case
00279 # only as well as the package name of the project it belongs to.
00280 #
00281 # For information on MATLAB's package and class folders, visit the following
00282 # web page from MathWorks:
00283 # @sa http://www.mathworks.com/help/techdoc/matlab_oop/brfynt_-1.html
00284 #
00285 # Example:
00286 # @code
00287 # import sbia.basis.cls
00288 # @endcode
00289 #
00290 # @ingroup BasisMatlabUtilities
00291 if (NOT PROJECT_IS_MODULE)
00292   if (BASIS_NAMESPACE)
00293     set (PROJECT_NAMESPACE_MATLAB "${BASIS_NAMESPACE_LOWER}.basis")
00294   else ()
00295     set (PROJECT_NAMESPACE_MATLAB "basis")
00296   endif ()
00297 else ()
00298   if (BASIS_USE_MODULE_NAMESPACES)
00299     set (PROJECT_NAMESPACE_MATLAB "${PROJECT_NAMESPACE_MATLAB}.basis")
00300   endif ()
00301 endif ()
00302 
00303 ## @brief Prefix for public header files.
00304 #
00305 # The prefix used for the output directory of the configured public header
00306 # files in the build tree and the installation of these under the
00307 # @c INSTALL_INCLUDE_DIR. The header files have to be included in a
00308 # source file using the entire relative path, e.g.,
00309 # @code
00310 # #include <sbia/basis/config.h>
00311 # @endcode
00312 # This avoids name conflicts among projects in a more reliable way then only
00313 # changing the order of paths in the include search path and is similar to
00314 # prefixing the file name of header files, but at the time avoids the use
00315 # of such prefixing of the file name itself for the developer.
00316 #
00317 # If this project is a module of another project, it appends its name to the
00318 # already set include prefix. Otherwise, the include prefix is set to the
00319 # common default prefix of BASIS projects first, i.e., "sbia", and then the
00320 # name of the project is appended.
00321 #
00322 # @note If the header file is private, i.e., not required by a public library
00323 #       and thus located in the @c PROJECT_CODE_DIR instead of the
00324 #       @c PROJECT_INCLUDE_DIR and therefore not installed, it can be
00325 #       included without the use of such relative path.
00326 #
00327 # @note The include prefix must end with a trailing slash if it is a
00328 #       subdirectory. BASIS will not use a slash by itself to separate the
00329 #       prefix from the header file name. This behavior eases the transition
00330 #       to a file name prefix if ever desired.
00331 if (NOT PROJECT_IS_MODULE)
00332   if (BASIS_NAMESPACE)
00333     set (INCLUDE_PREFIX "${BASIS_NAMESPACE_LOWER}/basis/")
00334   else ()
00335     set (INCLUDE_PREFIX "basis/")
00336   endif ()
00337 else ()
00338   if (BASIS_USE_MODULE_NAMESPACES)
00339     set (INCLUDE_PREFIX "${INCLUDE_PREFIX}/basis/")
00340   endif ()
00341 endif ()
00342 
00343 
00344 ## @}
00345 # end of Doxygen group