Settings.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 Settings.cmake
12 # @brief Non-default project settings.
13 #
14 # This file is included by basis_project_impl() after it looked for the
15 # required and optional dependencies and the CMake variables related to the
16 # project directory structure were defined (see BASISDirectories.cmake file
17 # in @c PROJECT_BINARY_DIR, where BASIS is here the name of the project).
18 # It is also included before the BasisSettings.cmake file.
19 #
20 # In particular, build options should be added in this file using CMake's
21 # <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:option">
22 # option()</a> command. Further, any common settings related to using a found
23 # dependency can be set here if the basis_use_package() command was enable
24 # to import the required configuration of a particular external package.
25 #
26 # @ingroup BasisSettings
27 ##############################################################################
28 
29 # ============================================================================
30 # directories
31 # ============================================================================
32 
33 # change default installation directory as name of BASIS package has changed
34 if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
35  string (REPLACE "/basis" "/cmake-basis" _PREFIX "${CMAKE_INSTALL_PREFIX}")
36  set (CMAKE_INSTALL_PREFIX "${_PREFIX}" CACHE PATH "Installation prefix." FORCE)
37  unset (_PREFIX)
38 endif ()
39 
40 # installation directory of CMake modules
41 set (INSTALL_MODULES_DIR "${INSTALL_SHARE_DIR}/modules")
42 set (INSTALL_FIND_MODULES_DIR "${INSTALL_SHARE_DIR}/find-modules")
43 
44 # installation directory of utilities template files
45 set (INSTALL_CXX_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
46 set (INSTALL_JAVA_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
47 set (INSTALL_PYTHON_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
48 set (INSTALL_PERL_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
49 set (INSTALL_MATLAB_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
50 set (INSTALL_BASH_TEMPLATES_DIR "${INSTALL_SHARE_DIR}/utilities")
51 
52 # common prefix of Sphinx extensions
53 set (SPHINX_EXTENSIONS_PREFIX "basis/sphinx/ext/")
54 # installation directory of Sphinx themes
55 set (INSTALL_SPHINX_THEMES_DIR "${INSTALL_SHARE_DIR}/sphinx-themes")
56 
57 # ============================================================================
58 # utilities
59 # ============================================================================
60 
61 # system checks
62 include (CheckTypeSize)
63 include (CheckIncludeFileCXX)
64 
65 # check if type long long is supported
66 CHECK_TYPE_SIZE ("long long" LONG_LONG)
67 
70 else ()
71  set (HAVE_LONG_LONG 0)
72 endif ()
73 
74 # check for presence of sstream header
75 include (TestForSSTREAM)
76 
77 if (CMAKE_NO_ANSI_STRING_STREAM)
78  set (HAVE_SSTREAM 0)
79 else ()
80  set (HAVE_SSTREAM 1)
81 endif ()
82 
83 # check if tr/tuple header file is available
84 if (CMAKE_GENERATOR MATCHES "Visual Studio [1-9][0-9]+")
86 else ()
87  CHECK_INCLUDE_FILE_CXX ("tr1/tuple" HAVE_TR1_TUPLE)
89  set (HAVE_TR1_TUPLE 1)
90  else ()
91  set (HAVE_TR1_TUPLE 0)
92  endif ()
93 endif ()
94 
95 # check for availibility of pthreads library
96 # defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT
97 find_package (Threads)
98 
99 if (Threads_FOUND)
100  if (CMAKE_USE_PTHREADS_INIT)
101  set (HAVE_PTHREAD 1)
102  else ()
103  set (HAVE_PTHREAD 0)
104  endif ()
105 endif ()
106 
107 # list of enabled utilities
108 # in case of other projects defined by BASISConfig.cmake
110 if (PythonInterp_FOUND)
111  list (APPEND BASIS_UTILITIES_ENABLED PYTHON)
112 endif ()
113 if (Perl_FOUND)
114  list (APPEND BASIS_UTILITIES_ENABLED PERL)
115 endif ()
116 if (BASH_FOUND)
117  list (APPEND BASIS_UTILITIES_ENABLED BASH)
118 endif ()
119 
120 # configure all BASIS utilities such that they are included in API
121 # documentation even if BASIS does not use them itself
122 if (Java_FOUND)
123  basis_set_project_property (PROPERTY PROJECT_USES_JAVA_UTILITIES TRUE)
124 endif ()
125 if (PythonInterp_FOUND)
126  basis_set_project_property (PROPERTY PROJECT_USES_PYTHON_UTILITIES TRUE)
127 endif ()
128 if (Perl_FOUND)
129  basis_set_project_property (PROPERTY PROJECT_USES_PERL_UTILITIES TRUE)
130 endif ()
131 if (BASH_FOUND)
132  basis_set_project_property (PROPERTY PROJECT_USES_BASH_UTILITIES TRUE)
133 endif ()
135  basis_set_project_property (PROPERTY PROJECT_USES_MATLAB_UTILITIES TRUE)
136 endif ()
137 
138 # target UIDs of BASIS libraries; these would be set by the package configuration
139 # file if this BASIS project would not be BASIS itself
140 if (BASIS_USE_TARGET_UIDS AND BASIS_USE_FULLY_QUALIFIED_UIDS)
141  set (NS "basis.")
142 else ()
143  set (NS)
144 endif ()
145 set (BASIS_CXX_UTILITIES_LIBRARY "${NS}utilities_cxx")
146 set (BASIS_PYTHON_UTILITIES_LIBRARY "${NS}utilities_python")
147 set (BASIS_PERL_UTILITIES_LIBRARY "${NS}utilities_perl")
148 set (BASIS_BASH_UTILITIES_LIBRARY "${NS}utilities_bash")
149 set (BASIS_TEST_LIBRARY "${NS}testlib")
150 set (BASIS_TEST_MAIN_LIBRARY "${NS}testmain")
151 
152 # ============================================================================
153 # configure public header files
154 # ============================================================================
155 
157  configure_file ("include/basis/config.h.in" "${BINARY_INCLUDE_DIR}/basis/config.h")
158 endif ()
cmake INSTALL_SPHINX_THEMES_DIR
Definition: Settings.cmake:55
cmake INSTALL_PYTHON_TEMPLATES_DIR
Definition: Settings.cmake:47
cmake INSTALL_PERL_TEMPLATES_DIR
Definition: Settings.cmake:48
cmake BASIS_PERL_UTILITIES_LIBRARY
Definition: Settings.cmake:147
cmake HAVE_LONG_LONG
Definition: Settings.cmake:69
cmake BASIS_CONFIGURE_PUBLIC_HEADERS
Whether BASIS should configure any public header file with the .in file name suffix.
cmake INSTALL_CXX_TEMPLATES_DIR
Definition: Settings.cmake:45
cmake INSTALL_JAVA_TEMPLATES_DIR
Definition: Settings.cmake:46
cmake INSTALL_MATLAB_TEMPLATES_DIR
Definition: Settings.cmake:49
function basis_set_project_property()
Set project-global property.
cmake HAVE_TR1_TUPLE
Definition: Settings.cmake:85
cmake INSTALL_MODULES_DIR
Definition: Settings.cmake:41
cmake INSTALL_FIND_MODULES_DIR
Definition: Settings.cmake:42
cmake BASIS_USE_FULLY_QUALIFIED_UIDS
Whether BASIS shall use fully-qualified target UIDs.
cmake BASIS_TEST_MAIN_LIBRARY
Definition: Settings.cmake:150
cmake SPHINX_EXTENSIONS_PREFIX
Definition: Settings.cmake:53
cmake Perl_FOUND
Definition: FindPerl.cmake:105
cmake CMAKE_INSTALL_PREFIX
Definition: Settings.cmake:29
cmake BASIS_PYTHON_UTILITIES_LIBRARY
Definition: Settings.cmake:146
cmake HAVE_SSTREAM
Definition: Settings.cmake:78
cmake BASIS_TEST_LIBRARY
Definition: Settings.cmake:149
cmake CXX
cmake HAVE_PTHREAD
Definition: Settings.cmake:101
cmake INSTALL_BASH_TEMPLATES_DIR
Definition: Settings.cmake:50
cmake MATLAB_FOUND
cmake NS
Definition: Settings.cmake:141
cmake BASIS_CXX_UTILITIES_LIBRARY
Definition: Settings.cmake:145
cmake BASIS_BASH_UTILITIES_LIBRARY
Definition: Settings.cmake:148
macro find_package()
Overloaded find_package() command.
if(oldcoutbuf)
cmake BASIS_UTILITIES_ENABLED
Definition: Settings.cmake:109