Module reference¶
boost.cmake¶
Detect, build, and link Boost libraries. This modules downloads the .zip archive from SourceForge at Autocmake update time. Note that the build-up commands are not Windows-compatible!
Your autocmake.cfg should look like this:
[boost]
override: {'major': 1, 'minor': 59, 'patch': 0, 'components': 'chrono;timer;system'}
source: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost.cmake
Cross-dependencies between required components are not checked for. For example, Boost.Timer depends on Boost.Chrono and Boost.System thus you should ask explicitly for all three. If the self-build of Boost components is triggered the BUILD_CUSTOM_BOOST variable is set to TRUE. The CMake target custom_boost is also added. You should use these two to ensure the right dependencies between your targets and the Boost headers/libraries, in case the self-build is triggered. For example:
if(BUILD_CUSTOM_BOOST)
add_dependencies(your_target custom_boost)
endif()
will ensure that your_target is built after custom_boost if and only if the self-build of Boost took place. This is an important step to avoid race conditions when building on multiple processes.
Dependencies:
mpi - Only if the Boost.MPI library is a needed component
python_libs - Only if the Boost.Python library is a needed component
Variables used:
BOOST_MINIMUM_REQUIRED - Minimum required version of Boost
BOOST_COMPONENTS_REQUIRED - Components (compiled Boost libraries) required
PROJECT_SOURCE_DIR
PROJECT_BINARY_DIR
CMAKE_BUILD_TYPE
MPI_FOUND
BUILD_CUSTOM_BOOST
autocmake.cfg configuration:
major=1
minor=48
patch=0
components=''
fetch: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_unpack.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_userconfig.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_configure.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_build.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_install.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_headers.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/boost/boost_cleanup.cmake
http://sourceforge.net/projects/boost/files/boost/%(major)s.%(minor)s.%(patch)s/boost_%(major)s_%(minor)s_%(patch)s.zip
docopt: --boost-headers=<BOOST_INCLUDEDIR> Include directories for Boost [default: ''].
--boost-libraries=<BOOST_LIBRARYDIR> Library directories for Boost [default: ''].
--build-boost=<FORCE_CUSTOM_BOOST> Deactivate Boost detection and build on-the-fly <ON/OFF> [default: OFF].
define: '-DBOOST_INCLUDEDIR="{0}"'.format(arguments['--boost-headers'])
'-DBOOST_LIBRARYDIR="{0}"'.format(arguments['--boost-libraries'])
'-DFORCE_CUSTOM_BOOST="{0}"'.format(arguments['--build-boost'])
'-DBOOST_MINIMUM_REQUIRED="%(major)s.%(minor)s.%(patch)s"'
'-DBOOST_COMPONENTS_REQUIRED="%(components)s"'
cc.cmake¶
Adds C support. Appends EXTRA_CFLAGS to CMAKE_C_FLAGS. If environment variable CFLAGS is set, then the CFLAGS are used and no other flags are used or appended.
Variables used:
EXTRA_CFLAGS
Variables modified:
CMAKE_C_FLAGS
Environment variables used:
CFLAGS
autocmake.cfg configuration:
docopt: --cc=<CC> C compiler [default: gcc].
--extra-cc-flags=<EXTRA_CFLAGS> Extra C compiler flags [default: ''].
export: 'CC={0}'.format(arguments['--cc'])
define: '-DEXTRA_CFLAGS="{0}"'.format(arguments['--extra-cc-flags'])
ccache.cmake¶
Adds ccache support. The user should export the appropriate environment variables to tweak the program’s behaviour, as described in its manpage. Notice that some additional compiler flags might be needed in order to avoid unnecessary warnings.
Variables defined:
CCACHE_FOUND
autocmake.cfg configuration:
docopt: --ccache=<USE_CCACHE> Toggle use of ccache <ON/OFF> [default: ON].
define: '-DUSE_CCACHE="{0}"'.format(arguments['--ccache'])
code_coverage.cmake¶
Enables code coverage by appending corresponding compiler flags.
Variables modified (provided the corresponding language is enabled):
CMAKE_Fortran_FLAGS
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
autocmake.cfg configuration:
docopt: --coverage Enable code coverage [default: False].
define: '-DENABLE_CODE_COVERAGE=%s' % arguments['--coverage']
cxx.cmake¶
Adds C++ support. Appends EXTRA_CXXFLAGS to CMAKE_CXX_FLAGS. If environment variable CXXFLAGS is set, then the CXXFLAGS are used and no other flags are used or appended.
Variables used:
EXTRA_CXXFLAGS
Variables modified:
CMAKE_CXX_FLAGS
Environment variables used:
CXXFLAGS
autocmake.cfg configuration:
docopt: --cxx=<CXX> C++ compiler [default: g++].
--extra-cxx-flags=<EXTRA_CXXFLAGS> Extra C++ compiler flags [default: ''].
export: 'CXX={0}'.format(arguments['--cxx'])
define: '-DEXTRA_CXXFLAGS="{0}"'.format(arguments['--extra-cxx-flags'])
default_build_paths.cmake¶
Sets binary and library output directories to ${PROJECT_BINARY_DIR}/bin and ${PROJECT_BINARY_DIR}/lib, respectively.
Variables modified:
CMAKE_RUNTIME_OUTPUT_DIRECTORY
CMAKE_LIBRARY_OUTPUT_DIRECTORY
definitions.cmake¶
Add preprocessor definitions (example: –add-definitions=”-DTHIS -DTHAT=137”). These are passed all the way down to the compiler.
Variables used:
PREPROCESSOR_DEFINITIONS
autocmake.cfg configuration:
docopt: --add-definitions=<STRING> Add preprocesor definitions [default: ''].
define: '-DPREPROCESSOR_DEFINITIONS="%s"' % arguments['--add-definitions']
fc.cmake¶
Adds Fortran support. Appends EXTRA_FCFLAGS to CMAKE_Fortran_FLAGS. If environment variable FCFLAGS is set, then the FCFLAGS are used and no other flags are used or appended.
Variables used:
EXTRA_FCFLAGS
Variables defined:
CMAKE_Fortran_MODULE_DIRECTORY
Variables modified:
CMAKE_Fortran_FLAGS
Environment variables used:
FCFLAGS
autocmake.cfg configuration:
docopt: --fc=<FC> Fortran compiler [default: gfortran].
--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: ''].
export: 'FC={0}'.format(arguments['--fc'])
define: '-DEXTRA_FCFLAGS="{0}"'.format(arguments['--extra-fc-flags'])
fc_optional.cmake¶
Adds optional Fortran support. Appends EXTRA_FCFLAGS to CMAKE_Fortran_FLAGS. If environment variable FCFLAGS is set, then the FCFLAGS are used and no other flags are used or appended.
Variables used:
EXTRA_FCFLAGS
ENABLE_FC_SUPPORT
Variables defined:
CMAKE_Fortran_MODULE_DIRECTORY
Variables modified:
CMAKE_Fortran_FLAGS
Variables defined:
ENABLE_FC_SUPPORT
Environment variables used:
FCFLAGS
autocmake.cfg configuration:
docopt: --fc=<FC> Fortran compiler [default: gfortran].
--extra-fc-flags=<EXTRA_FCFLAGS> Extra Fortran compiler flags [default: ''].
--fc-support=<FC_SUPPORT> Toggle Fortran language support (ON/OFF) [default: ON].
export: 'FC={0}'.format(arguments['--fc'])
define: '-DEXTRA_FCFLAGS="{0}"'.format(arguments['--extra-fc-flags'])
'-DENABLE_FC_SUPPORT="{0}"'.format(arguments['--fc-support'])
git_info.cmake¶
Creates git_info.h in the build directory. This file can be included in sources to print Git repository version and status information to the program output.
autocmake.cfg configuration:
fetch: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/git_info/git_info_sub.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/git_info/git_info.h.in
git_info_sub.cmake¶
Creates git_info.h in the build directory. This file can be included in sources to print Git status information to the program output for reproducibility reasons.
googletest.cmake¶
Includes Google Test sources and adds a library “googletest”.
Variables used:
GOOGLETEST_ROOT
autocmake.cfg configuration:
define: '-DGOOGLETEST_ROOT=external/googletest/googletest'
int64.cmake¶
Enables 64-bit integer support for Fortran projects.
Variables modified (provided the corresponding language is enabled):
CMAKE_Fortran_FLAGS
autocmake.cfg configuration:
docopt: --int64 Enable 64bit integers [default: False].
define: '-DENABLE_64BIT_INTEGERS=%s' % arguments['--int64']
accelerate.cmake¶
Find and link to ACCELERATE.
Variables defined:
ACCELERATE_FOUND - describe me, uncached
ACCELERATE_LIBRARIES - describe me, uncached
ACCELERATE_INCLUDE_DIR - describe me, uncached
autocmake.cfg configuration:
docopt: --accelerate Find and link to ACCELERATE [default: False].
define: '-DENABLE_ACCELERATE=%s' % arguments['--accelerate']
fetch: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_libraries.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_include_files.cmake
acml.cmake¶
Find and link to ACML.
Variables defined:
ACML_FOUND
ACML_LIBRARIES
ACML_INCLUDE_DIR
autocmake.cfg configuration:
docopt: --acml Find and link to ACML [default: False].
define: '-DENABLE_ACML=%s' % arguments['--acml']
atlas.cmake¶
Find and link to ATLAS.
Variables defined:
ATLAS_FOUND
ATLAS_LIBRARIES
ATLAS_INCLUDE_DIR
autocmake.cfg configuration:
docopt: --atlas Find and link to ATLAS [default: False].
define: '-DENABLE_ATLAS=%s' % arguments['--atlas']
blas.cmake¶
Find and link to BLAS.
Variables defined:
BLAS_FOUND
BLAS_LIBRARIES
BLAS_INCLUDE_DIR
autocmake.cfg configuration:
docopt: --blas Find and link to BLAS [default: False].
define: '-DENABLE_BLAS=%s' % arguments['--blas']
cblas.cmake¶
Find and link to CBLAS.
Variables defined:
CBLAS_FOUND - describe me, uncached
CBLAS_LIBRARIES - describe me, uncached
CBLAS_INCLUDE_DIR - describe me, uncached
autocmake.cfg configuration:
docopt: --cblas Find and link to CBLAS [default: False].
define: '-DENABLE_CBLAS=%s' % arguments['--cblas']
fetch: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_libraries.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_include_files.cmake
goto.cmake¶
Find and link to Goto BLAS.
Variables defined:
GOTO_FOUND
GOTO_LIBRARIES
GOTO_INCLUDE_DIR
autocmake.cfg configuration:
docopt: --goto Find and link to GOTO [default: False].
define: '-DENABLE_GOTO=%s' % arguments['--goto']
lapack.cmake¶
Find and link to LAPACK.
Variables defined:
LAPACK_FOUND
LAPACK_LIBRARIES
LAPACK_INCLUDE_DIR
autocmake.cfg configuration:
docopt: --lapack Find and link to LAPACK [default: False].
define: '-DENABLE_LAPACK=%s' % arguments['--lapack']
lapacke.cmake¶
Find and link to LAPACKE.
Variables defined:
LAPACKE_FOUND - describe me, uncached
LAPACKE_LIBRARIES - describe me, uncached
LAPACKE_INCLUDE_DIR - describe me, uncached
autocmake.cfg configuration:
docopt: --lapacke Find and link to LAPACKE [default: False].
define: '-DENABLE_LAPACKE=%s' % arguments['--lapacke']
fetch: https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_libraries.cmake
https://github.com/coderefinery/autocmake/raw/stable-0.x/modules/find/find_include_files.cmake
math_libs.cmake¶
Detects and links to BLAS and LAPACK libraries.
Variables used:
MATH_LIB_SEARCH_ORDER, example: set(MATH_LIB_SEARCH_ORDER MKL ESSL OPENBLAS ATLAS ACML SYSTEM_NATIVE)
ENABLE_STATIC_LINKING
ENABLE_BLAS
ENABLE_LAPACK
BLAS_FOUND
LAPACK_FOUND
BLAS_LANG
LAPACK_LANG
BLAS_TYPE
LAPACK_TYPE
ENABLE_64BIT_INTEGERS
CMAKE_HOST_SYSTEM_PROCESSOR
BLACS_IMPLEMENTATION
MKL_FLAG
Variables defined:
MATH_LIBS
BLAS_FOUND
LAPACK_FOUND
Variables modified:
CMAKE_EXE_LINKER_FLAGS
Environment variables used:
MATH_ROOT
BLAS_ROOT
LAPACK_ROOT
MKL_ROOT
MKLROOT
autocmake.cfg configuration:
docopt: --blas=<BLAS> Detect and link BLAS library (auto or off) [default: auto].
--lapack=<LAPACK> Detect and link LAPACK library (auto or off) [default: auto].
--mkl=<MKL> Pass MKL flag to the Intel compiler and linker and skip BLAS/LAPACK detection (sequential, parallel, cluster, or off) [default: off].
define: '-DENABLE_BLAS=%s' % arguments['--blas']
'-DENABLE_LAPACK=%s' % arguments['--lapack']
'-DMKL_FLAG=%s' % arguments['--mkl']
'-DMATH_LIB_SEARCH_ORDER="MKL;ESSL;OPENBLAS;ATLAS;ACML;SYSTEM_NATIVE"'
'-DBLAS_LANG=Fortran'
'-DLAPACK_LANG=Fortran'
warning: 'This module is deprecated and will be removed in future versions'
mpi.cmake¶
Enables MPI support.
Variables used:
ENABLE_MPI
MPI_FOUND
Variables modified (provided the corresponding language is enabled):
CMAKE_Fortran_FLAGS
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
autocmake.cfg configuration:
docopt: --mpi Enable MPI parallelization [default: False].
define: '-DENABLE_MPI=%s' % arguments['--mpi']
omp.cmake¶
Enables OpenMP support.
Variables used:
ENABLE_OPENMP
OPENMP_FOUND
Variables modified (provided the corresponding language is enabled):
CMAKE_Fortran_FLAGS
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
autocmake.cfg configuration:
docopt: --omp Enable OpenMP parallelization [default: False].
define: '-DENABLE_OPENMP=%s' % arguments['--omp']
python_interpreter.cmake¶
Detects Python interpreter.
Variables used:
PYTHON_INTERPRETER - User-set path to the Python interpreter
Variables defined:
PYTHONINTERP_FOUND - Was the Python executable found
PYTHON_EXECUTABLE - path to the Python interpreter
PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
PYTHON_VERSION_MAJOR - Python major version found e.g. 2
PYTHON_VERSION_MINOR - Python minor version found e.g. 5
PYTHON_VERSION_PATCH - Python patch version found e.g. 2
autocmake.cfg configuration:
docopt: --python=<PYTHON_INTERPRETER> The Python interpreter (development version) to use. [default: ''].
define: '-DPYTHON_INTERPRETER="%s"' % arguments['--python']
python_libs.cmake¶
Detects Python libraries and headers. Detection is done basically by hand as the proper CMake package will not find libraries and headers matching the interpreter version.
Dependencies:
python_interpreter - Sets the Python interpreter for headers and libraries detection
Variables used:
PYTHONINTERP_FOUND - Was the Python executable found
Variables defined:
PYTHONLIBS_FOUND - have the Python libs been found
PYTHON_LIBRARIES - path to the python library
PYTHON_INCLUDE_DIRS - path to where Python.h is found
PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
safeguards.cmake¶
Provides safeguards against in-source builds and bad build types.
Variables used:
PROJECT_SOURCE_DIR
PROJECT_BINARY_DIR
CMAKE_BUILD_TYPE
save_flags.cmake¶
Take care of updating the cache for fresh configurations.
Variables modified (provided the corresponding language is enabled):
DEFAULT_Fortran_FLAGS_SET
DEFAULT_C_FLAGS_SET
DEFAULT_CXX_FLAGS_SET
version.cmake¶
Determine program version from file “VERSION” (example: “14.1”) The reason why this information is stored in a file and not as CMake variable is that CMake-unaware programs can parse and use it (e.g. Sphinx). Also web-based hosting frontends such as GitLab automatically use the file “VERSION” if present.
Variables defined:
PROGRAM_VERSION