Utilities implementated by the CMake modules. More...
Files | |
file | CheckPublicHeaders.cmake |
CMake script used to check whether public headers were added/removed. | |
file | ConfigureIncludeFiles.cmake |
CMake script used to configure and copy the public header files. | |
file | ExecuteProcess.cmake |
Execute process using CMake script mode. | |
file | TopologicalSort.cmake |
CMake implementation of topological sorting algorithm. | |
Functions | |
function | add_executable (in TARGET_UID, in ARGN) |
Add executable target. More... | |
function | add_library (in TARGET_UID, in ARGN) |
Add library target. More... | |
function | basis_add_bash_utilities_library (out UID) |
Add build target for BASIS Bash utilities library. More... | |
function | basis_add_custom_export_target (in TARGET_UID, in IS_TEST) |
Add target to custom export set. More... | |
macro | basis_add_custom_target (in TARGET_NAME) |
Add custom target. More... | |
function | basis_add_cxx_utilities_library (out UID) |
Add build target for BASIS C++ utilities library. More... | |
function | basis_add_executable_target (in TARGET_NAME, in ARGN) |
Add executable built from C++ source code. More... | |
function | basis_add_export_target (out EXPORT_OPTION, in TARGET_UID, in IS_TEST, in ARGN) |
Add target to export set. More... | |
function | basis_add_glob_target (in TARGET_UID, out SOURCES, in ARGN) |
Glob source files. More... | |
function | basis_add_imported_target (in TARGET, in TYPE) |
Add imported target. More... | |
function | basis_add_init_py_target () |
function | basis_add_library_target (in TARGET_NAME, in ARGN) |
Add library built from C++ source code. More... | |
function | basis_add_mcc_target (in TARGET_NAME, in ARGN) |
Add MATLAB Compiler target. More... | |
function | basis_add_mex_file (in TARGET_NAME, in ARGN) |
Add MEX-file target. More... | |
macro | basis_add_module_info (in MODULE_NAME, in F) |
Manually add project module to list of modules. More... | |
function | basis_add_perl_utilities_library (out UID) |
Add build target for BASIS Perl utilities library. More... | |
function | basis_add_python_utilities_library (out UID) |
Add build target for BASIS Python utilities library. More... | |
function | basis_add_script_library (in TARGET_NAME, in ARGN) |
Add script library target. More... | |
function | basis_add_tests_of_default_options (in TARGET_NAME) |
Add tests of default options for given executable. More... | |
function | basis_add_uninstall () |
Add uninstall target. More... | |
macro | basis_add_utilities_library (out UID, in LANGUAGE) |
Add build target for BASIS utilities library. More... | |
function | basis_append_to_each (in OUTPUT_LIST, in INPUT_LIST, in ITEM_TO_APPEND) |
basis_append_to_each takes an input list and appends a single element to each item in that list and appends it to the output list. For example, this is useful for adding relative paths to the end of a list of paths. More... | |
function | basis_build_mcc_target (in TARGET_UID) |
Add custom command for build of MATLAB Compiler target. More... | |
function | basis_build_mex_file (in TARGET_UID) |
Add custom command for build of MEX-file. More... | |
function | basis_build_script (in TARGET_UID) |
Add custom command for build of single script. More... | |
function | basis_build_script_library (in TARGET_UID) |
Add custom command for build of script library. More... | |
function | basis_buildtree_asserts (in ARGN) |
Ensure certain requirements on build tree. More... | |
function | basis_check_if_module_depends_on_package (out result, in module, in package) |
Check if named project module depends on the specified package. More... | |
function | basis_check_if_package_is_needed_by_modules (out result, in package, in ARGN) |
Check if any of the named/enabled modules depends on the specified package. More... | |
function | basis_check_target_name (in TARGET_NAME) |
Checks whether a given name is a valid target name. More... | |
function | basis_check_test_name (in TEST_NAME) |
Checks whether a given name is a valid test name. More... | |
macro | basis_compare_lists (out RESULT, in LIST1, in LIST2) |
Compare two lists. More... | |
macro | basis_compile_python_modules_for_jython (out FLAG) |
Whether to compile Python modules for Jython interpreter. More... | |
function | basis_configure_public_headers () |
Configure public header files. More... | |
macro | basis_configure_root_documentation_files () |
Configure root documentation files. More... | |
function | basis_configure_script (in INPUT, in OUTPUT, in ARGN) |
Configure and optionally compile script file. More... | |
function | basis_configure_script_libraries () |
Add library targets for the public modules in PROJECT_LIBRARY_DIR . More... | |
function | basis_configure_sources (out LIST_NAME, in ARGN) |
Configure .in source files. More... | |
function | basis_configure_utilities () |
Configure BASIS utilities. More... | |
function | basis_create_addpaths_mfile () |
This function writes a MATLAB M-file with addpath() statements. More... | |
function | basis_disable_testing_if_no_tests () |
Disable testing if project does not implement any tests. More... | |
function | basis_dump_variables (in RESULT_FILE) |
Output current CMake variables to file. More... | |
macro | basis_exists_target (out RESULT_VARIABLE, in TARGET_NAME) |
Whether a given target exists. More... | |
function | basis_export_build_properties (in CODE) |
Add code to set properties of imported targets for build tree. More... | |
function | basis_export_footer (in CODE) |
Add footer of exports file. More... | |
function | basis_export_header (in CODE) |
Generate header of exports file. More... | |
function | basis_export_import_targets (in CODE) |
Add code to add import targets. More... | |
function | basis_export_install_properties (in CODE) |
Add code to set properties of imported targets for installation. More... | |
function | basis_export_prefix (in CODE) |
Add code to compute prefix relative to INSTALL_CONFIG_DIR . More... | |
function | basis_export_targets () |
Export all targets added by basis_add_* commands. More... | |
function | basis_finalize_targets (in ARGN) |
Finalize custom targets by adding the missing build commands. More... | |
function | basis_find_logo (in OUTPUT_VARIABLE, in SPECIFIED_LOGO, in DEFAULT_NAME) |
Find standard project logo files with standardized PROJECT_${LOGO_TYPE}_LOGO variable names This is an internal function not designed for general use. More... | |
macro | basis_find_packages () |
Find packages this project depends on. More... | |
function | basis_get_bash_version (out ARGV1) |
Get version of Bash interpreter. More... | |
function | basis_get_build_timestamp (in TIMESTAMP) |
Get build time stamp. More... | |
function | basis_get_compiled_file (out CFILE, in SOURCE, in ARGV2) |
Get file name of compiled script. More... | |
macro | basis_get_compiled_jython_file_of_python_module (out CFILE, in MODULE) |
Get file path of Jython file compiled from the given Python module. More... | |
function | basis_get_full_matlab_version (out VERSION) |
Determine version of MATLAB installation. More... | |
function | basis_get_fully_qualified_target_uid (out TARGET_UID, in TARGET_NAME) |
Get fully-qualified target name. More... | |
function | basis_get_fully_qualified_test_uid (out TEST_UID, in TEST_NAME) |
Get "global" test name, i.e., actual CTest test name. More... | |
function | basis_get_jython_version (out ARGV1) |
Get version of Jython interpreter. More... | |
function | basis_get_matlab_release (out ARGV1) |
Get release version of MATLAB installation. More... | |
function | basis_get_matlab_version (out ARGV1) |
Get version of MATLAB installation. More... | |
function | basis_get_module_info (in MODULE_NAME, in F, in ARGN) |
function | basis_get_perl_version (out ARGV1) |
Get version of Perl interpreter. More... | |
function | basis_get_project_property (out VARIABLE, in ARGN) |
Get project-global property value. More... | |
function | basis_get_project_uses_utilities (in RETVAL) |
Determine whether this project uses any of the BASIS Utilities. More... | |
macro | basis_get_property (in ARGN) |
function | basis_get_python_version (out ARGV1) |
Get version of Python interpreter. More... | |
function | basis_get_revision (in URL, out REV) |
Get revision of file or directory. More... | |
function | basis_get_soname (out SONAME, in OBJFILE) |
Get soname of object file. More... | |
function | basis_get_source_language (out LANGUAGE, in ARGN) |
Detect programming language of given source code files. More... | |
function | basis_get_source_target_name (out TARGET_NAME, in SOURCE_FILE, in ARGN) |
Derive target name from source file name. More... | |
function | basis_get_target_link_libraries (out LINK_DEPENDS, in TARGET_NAME) |
Get link libraries/dependencies of (imported) target. More... | |
function | basis_get_target_location (out VAR, in TARGET_NAME, in PART) |
Get location of build target output file(s). More... | |
function | basis_get_target_name (out TARGET_NAME, in TARGET_UID) |
Get "local" target name, i.e., BASIS target name without check of UID. More... | |
function | basis_get_target_namespace (out TARGET_NS, in TARGET_UID) |
Get namespace of build target without check of UID. More... | |
function | basis_get_target_type (out TYPE, in TARGET_NAME) |
Get type name of target. More... | |
function | basis_get_target_uid (out TARGET_UID, in TARGET_NAME) |
Get "global" target name, i.e., actual CMake target name. More... | |
function | basis_get_test_name (out TEST_NAME, in TEST_UID) |
Get "local" test name, i.e., BASIS test name. More... | |
function | basis_get_test_namespace (out TEST_NS, in TEST_UID) |
Get namespace of test. More... | |
function | basis_get_test_uid (out TEST_UID, in TEST_NAME) |
Get "global" test name, i.e., actual CTest test name. More... | |
function | basis_git_get_revision (in URL, out REV, in ARGN) |
Get HEAD commit SHA of file or directory. More... | |
macro | basis_initialize_settings () |
Initialize project settings. More... | |
function | basis_install_links () |
Adds installation rules to create default symbolic links. More... | |
macro | basis_install_public_headers () |
Add installation rules for public header files. More... | |
function | basis_install_template (in TEMPLATE, in DESTINATION) |
Add installation rule for project template. More... | |
function | basis_installtree_asserts (in ARGN) |
Ensure certain requirements on install tree. More... | |
macro | basis_is_cached (out VAR, in ENTRY) |
Determine if cache entry exists. More... | |
function | basis_is_git_repository (in FLAG, in DIR) |
function | basis_join (in VALUES, in DELIMITER, out OUTPUT) |
Concatenates all list elements into a single delimited string. More... | |
macro | basis_library_prefix (out PREFIX, in LANGUAGE) |
Get default subdirectory prefix of scripted library modules. More... | |
function | basis_list_to_delimited_string (out STR, in DELIM, in ARGN) |
Concatenates all list elements into a single delimited string. More... | |
macro | basis_list_to_regex (out REGEX, in ARGN) |
Convert list into regular expression. More... | |
function | basis_list_to_string (out STR, in ARGN) |
Concatenates all list elements into a single string. More... | |
function | basis_make_target_uid (out TARGET_UID, in TARGET_NAME) |
Make target UID from given target name. More... | |
function | basis_make_test_uid (out TEST_UID, in TEST_NAME) |
Make test UID from given test name. More... | |
function | basis_mexext (out ARGN) |
Determine extension of MEX-files for this architecture. More... | |
macro | basis_module_enable (in MODULE, in NEEDED_BY) |
function | basis_normalize_name (out OUT, in STR) |
Convert string to lowercase only or mixed case. More... | |
function | basis_process_generator_expressions (out ARGS, in ARGN) |
Process generator expressions in arguments. More... | |
macro | basis_project_initialize () |
Initialize project, calls CMake's project() command. More... | |
macro | basis_project_modules () |
Initialize project modules. More... | |
function | basis_register_package () |
Register installed package with CMake. More... | |
macro | basis_remove_blank_line (in STRVAR) |
Remove one blank line from top of string. More... | |
macro | basis_sanitize_for_regex (out OUT, in STR) |
Sanitize string variable for use in regular expression. More... | |
macro | basis_set_config_option (out VAR, in OPT) |
Set value of variable to either 0 or 1 based on option value. More... | |
macro | basis_set_flag (in PREFIX, out FLAG, in DEFAULT) |
Set flag given mutually exclusive ARGN_<FLAG> and ARGN_NO<FLAG> function arguments. More... | |
macro | basis_set_if_empty (out VAR, in ARGN) |
Set value of variable only if variable is not set already. More... | |
macro | basis_set_if_not_set (out VAR, in ARGN) |
Set value of variable only if variable is not defined yet. More... | |
macro | basis_set_or_update_type (in VAR, in TYPE, in ARGN) |
Set type of variable. More... | |
macro | basis_set_or_update_value (in VAR) |
Set variable value. More... | |
function | basis_set_project_property () |
Set project-global property. More... | |
macro | basis_set_property (in ARGN) |
function | basis_set_target_install_rpath (in TARGET_NAME) |
Set INSTALL_RPATH property of executable or shared library target. More... | |
macro | basis_slicer_module_initialize () |
Initialize slicer module meta-data. More... | |
function | basis_slicer_module_to_extension_metadata () |
Copy MODULE_* metadata to EXTENSION_* metadata of Slicer Extension. More... | |
function | basis_string_to_list (out LST, in STR) |
Splits a string at space characters into a list. More... | |
function | basis_strip_target_uid (inout TARGET_UID) |
Strip of top-level package name from target UID if present. More... | |
function | basis_svn_get_last_changed_revision (in URL, out REV) |
Get revision number when directory or file was last changed. More... | |
function | basis_svn_get_revision (in URL, out REV) |
Get current revision of file or directory. More... | |
function | basis_svn_status (in URL, out STATUS) |
Get status of revision controlled file. More... | |
function | basis_tokenize_dependency (in DEP, out PKG, out VER, out CMP) |
Tokenize dependency specification. More... | |
function | basis_update_imported_location (in TARGET, in PROPERTY, in LOCATION) |
Update location of imported target. More... | |
function | basis_update_imported_type (in TARGET, in TYPE) |
Update type of imported target. More... | |
macro | basis_update_type_of_variable (in VAR, in TYPE) |
Change type of cached variable. More... | |
macro | basis_update_value (in VAR) |
Update cache variable. More... | |
function | basis_utilities_check (out VAR, in SOURCE_FILE, in ARGN) |
Check whether the BASIS utilities are used within a given source file. More... | |
function | basis_variable_check (in ARGN) |
Checks for a list of variables required later in the script. More... | |
function | basis_variable_value_status (out VAR_INFO_STRING, in ARGN) |
Create a string from a list of variables indicating if they are defined and their values. More... | |
function | basis_version_numbers (in VERSION, out MAJOR, out MINOR, out PATCH) |
Extract version numbers from version string. More... | |
macro | basis_write_addpaths_mfile (in MFILE, in ARGN) |
This function writes a MATLAB M-file with addpath() statements. More... | |
function | basis_write_list (in FILENAME, in VARIABLE) |
Write CMake script file which sets the named variable to the specified (list of) values. More... | |
macro | find_package () |
Overloaded find_package() command. More... | |
function | get_filename_component (inout ARGN) |
Fixes CMake's get_filename_component() command. More... | |
macro | include_directories (in ARGN) |
Add directories to search path for include files. More... | |
macro | link_directories (in ARGN) |
Add directories to search path for libraries. More... | |
function | set_target_properties (in ARGN) |
Set target property. More... | |
Variables | |
option | BUILD_ALL_MODULES = OFF |
cmake | CONFIG_FILE |
Name of the CMake package configuration file. More... | |
cmake | CONFIG_PREFIX |
Package name. More... | |
cmake | CUSTOM_EXPORTS_FILE |
Name of the CMake target exports file for custom targets. More... | |
cmake | EXPORTS_FILE |
Name of the CMake target exports file. More... | |
cmake | msg |
cmake | PROJECT_MODULES_DISABLED |
cmake | PROJECT_MODULES_ENABLED |
cmake | PROJECT_MODULES_SORTED |
cmake | USE_FILE |
Name of the CMake package use file. More... | |
cmake | VERSION_FILE |
Name of the CMake package version file. More... | |
Utilities implementated by the CMake modules.
Names of recognized properties on tests.
Unfortunately, the ARGV
and ARGN
arguments of a CMake function() or macro() does not preserve values which themselves are lists. Therefore, it is not possible to distinguish between property names and their values in the arguments passed to basis_set_tests_properties(). To overcome this problem, this list specifies all the possible property names. Everything else is considered to be a property value except the first argument follwing right after the PROPERTIES
keyword. Alternatively, basis_set_property() can be used as here no disambiguity exists.
function add_executable | ( | in | TARGET_UID, |
in | ARGN | ||
) |
Add executable target.
This BASIS function overwrites CMake's add_executable() command in order to store information of imported targets which is in particular used to generate the source code of the ExecutableTargetInfo modules which are part of the BASIS utilities.
[in] | TARGET_UID | Name of the target. |
[in] | ARGN | Further arguments of CMake's add_executable(). |
function add_library | ( | in | TARGET_UID, |
in | ARGN | ||
) |
Add library target.
This BASIS function overwrites CMake's add_library() command in order to store information of imported targets.
[in] | TARGET_UID | Name of the target. |
[in] | ARGN | Further arguments of CMake's add_library(). |
function basis_add_bash_utilities_library | ( | out | UID | ) |
Add build target for BASIS Bash utilities library.
This function is called by basis_target_link_libraries() in order to add the "basis" build target for the project-specific BASIS Bash utilities. If the target was added before, it is only used to get the target UID of this build target so the executable or library can be linked to it.
[out] | UID | UID of added build target. |
function basis_add_custom_export_target | ( | in | TARGET_UID, |
in | IS_TEST | ||
) |
Add target to custom export set.
Targets are added to the export set named after the top-level project. This is necessary because CMake does not allow us to split the exports into different sets when there are inter-dependencies between library targets of the modules.
[in] | TARGET_UID | UID of target to add to the export set. |
[in] | IS_TEST | Whether given target is a test executable or library. |
macro basis_add_custom_target | ( | in | TARGET_NAME | ) |
Add custom target.
function basis_add_cxx_utilities_library | ( | out | UID | ) |
Add build target for BASIS C++ utilities library.
This function is called by basis_add_executable_target() and basis_add_library_target() in order to add the "basis" build target for the static project-specific BASIS utilities library for C++. If the target was added before, it is only used to get the target UID of this build target so the newly added executable or library can be linked to it.
The CMake function add_library() checks if the specified source code files exist. If a source file is not found, an error is raised by CMake. The BASIS utilities can, however, only be configured at the end of the configuration step. Therefore, this function simply writes dummy C++ source files in order to pass the existence check. The actual source files are configured by the function basis_configure_utilities() which is called by basis_project_end().
After writing these dummy source files, a library build target for the project-specific BASIS C++ utilities is added. This build target is not being build as part of the ALL target in case it is never used by any of the build targets of the project. Only if build target links to this library, it will be build and installed.
[out] | UID | UID of added build target. |
function basis_add_executable_target | ( | in | TARGET_NAME, |
in | ARGN | ||
) |
Add executable built from C++ source code.
CXX
(i.e., C/C++).This function adds an executable target for the build of an executable from C++ source code files. Refer to the documentation of basis_add_executable() for a description of general options for adding an executable target.
By default, the BASIS C++ utilities library is added as link dependency. If none of the BASIS C++ utilities are used by this target, the option NO_BASIS_UTILITIES can be given. To enable this option by default, set the variable BASIS_UTILITIES
to FALSE
, best in the Settings.cmake
file located in the PROJECT_CONFIG_DIR
(add such file if missing). If the use of the BASIS C++ utilities is disabled by default, the USE_BASIS_UTILITIES
option can be used to enable them for this target only. Note that the utilities library is a static library and thus the linker would simply not include any of the BASIS utility functions in the final binary file if not used. The only advantage of setting BASIS_UTILITIES
to FALSE
or to always specify NO_BASIS_UTILITIES
if no target uses the utilities is that the BASIS utilities library will not be build in this case.
[in] | TARGET_NAME | Name of build target. |
[in] | ARGN | This argument list is parsed and the following arguments are extracted, all other arguments are considered to be source code files and simply passed on to CMake's add_executable() command. |
COMPONENT name | Name of component as part of which this executable will be installed if the specified DESTINATION is not "none". (default: BASIS_RUNTIME_COMPONENT ) |
DESTINATION dir | Installation directory relative to CMAKE_INSTALL_PREFIX . If "none" (case-insensitive) is given as argument, no default installation rules are added for this executable target. (default: INSTALL_RUNTIME_DIR or INSTALL_LIBEXEC_DIR if LIBEXEC is given) |
LIBEXEC | Specifies that the built executable is an auxiliary executable which is only called by other executables. (default: FALSE ) |
[NO]EXPORT | Whether to export this target. (default: TRUE ) |
NO_BASIS_UTILITIES | Specify that the BASIS utilities are not used by this executable and hence no link dependency on the BASIS utilities library shall be added. (default: NOT BASIS_UTILITIES ) |
USE_BASIS_UTILITIES | Specify that the BASIS utilities are used and required by this executable and hence a link dependency on the BASIS utilities library has to be added. (default: BASIS_UTILITIES ) |
function basis_add_export_target | ( | out | EXPORT_OPTION, |
in | TARGET_UID, | ||
in | IS_TEST, | ||
in | ARGN | ||
) |
Add target to export set.
Targets are added to the export set named after the top-level project. This is necessary because CMake does not allow us to split the exports into different sets when there are inter-dependencies between library targets of the modules.
[out] | EXPORT_OPTION | Export option for install() command including the EXPORT option name. Set to an empty string if target is not installed (see ARGN ). |
[in] | TARGET_UID | UID of target to be exported. |
[in] | IS_TEST | Whether given target is a test executable or library. |
[in] | ARGN | Optional installation destinations. The actual values are ignored and argument TRUE should be used if no specific destination paths are given, but the target is also to be included in the export set used for installation. If ARGN is empty, the target is only added to the build tree export set. When ARGN is 0 , FALSE or OFF , the target is not added to list of installation exports. |
function basis_add_glob_target | ( | in | TARGET_UID, |
out | SOURCES, | ||
in | ARGN | ||
) |
Glob source files.
This function gets a list of source files and globbing expressions, evaluates the globbing expression, and replaces these by the found source files such that the resulting list of source files contains only absolute paths of source files. It is used by basis_add_executable() and basis_add_library() to get a list of all source files. The syntax for the glob expressions corresponds to the one used by CMake's file(GLOB) command. Additionally, if the pattern **
is found in a glob expression, it is replaced by a single *
and the recursive version, i.e., file(GLOB_RECURSE)
, is used instead.
[in] | TARGET_UID | UID of build target which builds the globbed source files. The custom target which re-globs the source files before each build of this target is named after this build target with two leading underscores (__). |
[out] | SOURCES | List of absolute source paths. |
[in] | ARGN | Input file paths and/or globbing expressions. |
function basis_add_imported_target | ( | in | TARGET, |
in | TYPE | ||
) |
Add imported target.
Imported targets are only valid in the scope where they were imported. In order to be able to add the information of the imported executable targets to the ExecutableTargetInfo modules of the BASIS utilities which are configured during the finalization of the (top-level) project, the information of imported targets has to be stored in the global scope. Therefore, internal cache variables prefixed by the name of the project are used (see basis_set_project_property()):
IMPORTED_TARGETS | List of imported targets. |
IMPORTED_TYPES | Types of imported targets. |
IMPORTED_LOCATIONS | Locations of imported target files. |
IMPORTED_RANKS | Rank of current imported locations. This rank value is used to decide whether the current location takes precedence over another imported location. For example, IMPORTED_LOCATION_<a>, may be preferred over IMPORTED_LOCATION_<b>. |
[in] | TARGET | Name (UID) of the imported target. |
[in] | TYPE | Type of the imported target. |
function basis_add_init_py_target | ( | ) |
function basis_add_library_target | ( | in | TARGET_NAME, |
in | ARGN | ||
) |
Add library built from C++ source code.
CXX
(i.e., C/C++) and the option MEX
is not given.This function adds a library target which builds a library from C++ source code files. Refer to the documentation of basis_add_library() for a description of the general options for adding a library target.
By default, the BASIS C++ utilities library is added as link dependency. If none of the BASIS C++ utilities are used by this target, the option NO_BASIS_UTILITIES can be given. To enable this option by default, set the variable BASIS_UTILITIES
to FALSE
, best in the Settings.cmake
file located in the PROJECT_CONFIG_DIR
(add such file if missing). If the use of the BASIS C++ utilities is disabled by default, the USE_BASIS_UTILITIES
option can be used to enable them for this target only. Note that the utilities library is a static library and thus the linker would simply not include any of the BASIS utility functions in the final binary file if not used. The only advantage of setting BASIS_UTILITIES
to FALSE
or to always specify NO_BASIS_UTILITIES
if no target uses the utilities is that the BASIS utilities library will not be build in this case.
[in] | TARGET_NAME | Name of build target. |
[in] | ARGN | This argument list is parsed and the following arguments are extracted. All other arguments are considered to be source code files and simply passed on to CMake's add_library() command. |
STATIC|SHARED|MODULE | Type of the library. (default: SHARED if BUILD_SHARED_LIBS evaluates to true or STATIC otherwise) |
COMPONENT name | Name of component as part of which this library will be installed if either the RUNTIME_INSTALL_DIRECTORY or LIBRARY_INSTALL_DIRECTORY property is not "none". Used only if either RUNTIME_COMPONENT or LIBRARY_COMPONENT not specified. (default: see RUNTIME_COMPONENT and LIBRARY_COMPONENT ) |
DESTINATION dir | Installation directory for runtime and library component relative to CMAKE_INSTALL_PREFIX . Used only if either RUNTIME_DESTINATION or LIBRARY_DESTINATION not specified. If "none" (case-insensitive) is given as argument, no default installation rules are added. (default: see RUNTIME_DESTINATION and LIBRARY_DESTINATION ) |
LIBRARY_COMPONENT name | Name of component as part of which import/static library will be intalled if LIBRARY_INSTALL_DIRECTORY property is not "none". (default: COMPONENT if specified or BASIS_LIBRARY_COMPONENT otherwise) |
LIBRARY_DESTINATION dir | Installation directory of the library component relative to CMAKE_INSTALL_PREFIX . If "none" (case-insensitive) is given as argument, no installation rule for the library component is added. (default: INSTALL_ARCHIVE_DIR ) |
RUNTIME_COMPONENT name | Name of component as part of which runtime library will be installed if RUNTIME_INSTALL_DIRECTORY property is not "none". (default: COMPONENT if specified or BASIS_RUNTIME_COMPONENT otherwise) |
RUNTIME_DESTINATION dir | Installation directory of the runtime component relative to CMAKE_INSTALL_PREFIX . If "none" (case-insensitive) is given as argument, no installation rule for the runtime library is added. (default: INSTALL_LIBRARY_DIR on Unix or INSTALL_RUNTIME_DIR Windows) |
[NO]EXPORT | Whether to export this target. (default: TRUE ) |
NO_BASIS_UTILITIES | Specify that the BASIS utilities are not used by this executable and hence no link dependency on the BASIS utilities library shall be added. (default: NOT BASIS_UTILITIES) |
USE_BASIS_UTILITIES | Specify that the BASIS utilities are used and required by this executable and hence a link dependency on the BASIS utilities library shall be added. (default: BASIS_UTILITIES ) |
function basis_add_mcc_target | ( | in | TARGET_NAME, |
in | ARGN | ||
) |
Add MATLAB Compiler target.
MATLAB
.This function is used to add an executable or shared library target which is built using the MATLAB Compiler (MCC).
A custom CMake build target with the following properties is added by this function to the build system. These properties are used by basis_build_mcc_target() to generate a build script written in CMake code which is executed by a custom CMake command. Before the invokation of basis_build_mcc_target(), the target properties can be modified using basis_set_target_properties().
TODO |
An install command for the added executable or library target is added by this function as well. The executable will be installed as part of the RUNTIME_COMPONENT
in the directory INSTALL_RUNTIME_DIR
. The runtime library will be installed as part of the RUNTIME_COMPONENT
in the directory INSTALL_LIBRARY_DIR
on Unix and INSTALL_RUNTIME_DIR
on Windows. Static/import libraries will be installed as part of the LIBRARY_COMPONENT
in the directory INSTALL_ARCHIVE_DIR
.
PROJECT_TESTING_DIR
, the built executable is output to the BINARY_TESTING_DIR
directory tree instead. Moreover, no installation rules are added. Test executables are further not exported, regardless of the value of the EXPORT
property.[in] | TARGET_NAME | Name of build target. |
[in] | ARGN | The remaining arguments are parsed and the following arguments extracted. All unparsed arguments are treated as the MATLAB or C/C++ source files, respectively. |
EXECUTABLE|LIBEXEC|SHARED | Type of the MATLAB Compiler target which can be either a stand-alone executable, an auxiliary executable, or a shared library. (default: EXECUTABLE ) |
COMPONENT name | Name of component as part of which this executable or library will be installed if the RUNTIME_INSTALL_DIRECTORY or LIBRARY_INSTALL_DIRECTORY property is not "none". Used only if RUNTIME_COMPONENT or LIBRARY_COMPONENT not specified. (default: see RUNTIME_COMPONENT and LIBRARY_COMPONENT arguments) |
DESTINATION dir | Installation directory for executable or runtime and library component of shared library relative to CMAKE_INSTALL_PREFIX . Used only if RUNTIME_DESTINATION or LIBRARY_DESTINATION not specified. If "none" (case-insensitive) is given as argument, no default installation rules are added. (default: see RUNTIME_DESTINATION and LIBRARY_DESTINATION arguments) |
LIBRARY_COMPONENT name | Name of component as part of which import/static library will be intalled if a shared library is build and the LIBRARY_INSTALL_DIRECTORY property is not "none". (default: COMPONENT if specified or BASIS_LIBRARY_COMPONENT otherwise) |
LIBRARY_DESTINATION dir | Installation directory of the library component relative to CMAKE_INSTALL_PREFIX . If "none" (case-insensitive) is given as argument or an executable is build, no installation rule for the library component is added. (default: INSTALL_ARCHIVE_DIR ) |
HEADER_DESTINATION dir | Installation directory of the library header file relative to INSTALL_INCLUDE_DIR . If "none" (case-insensitive) is given as argument or an executable is build, no installation rule for the library header file is added. (default: INSTALL_INCLUDE_DIR ) |
RUNTIME_COMPONENT name | Name of component as part of which executable or runtime library, respectively, will be installed if the RUNTIME_INSTALL_DIRECTORY property is not "none". (default: COMPONENT if specified or BASIS_RUNTIME_COMPONENT otherwise) |
RUNTIME_DESTINATION dir | Installation directory of the executable or runtime component of the shared library relative to CMAKE_INSTALL_PREFIX . If "none" (case-insensitive) is given as argument, no installation rule for the runtime library is added. (default: INSTALL_LIBRARY_DIR for shared libraries on Unix or INSTALL_RUNTIME_DIR otherwise) |
[NO]EXPORT | Whether to export this target. (default: TRUE ) |
NO_BASIS_UTILITIES | Specify that the BASIS utilities are not used by this executable or shared library and hence no link dependency on the BASIS utilities shall be added. (default: NOT BASIS_UTILITIES) |
USE_BASIS_UTILITIES | Specify that the BASIS utilities are used and required by this executable or shared library, respectively, and hence a link dependency on the BASIS utilities must be added. (default: BASIS_UTILITIES ) |
FINAL | Finalize custom targets immediately. Any following target property changes will have no effect. When this option is used, the custom target which executes the custom build command is added in the current working directory. Otherwise it will be added in the top-level source directory of the project. Which with the Visual Studio generators adds the corresponding Visual Studio Project files directly to the top-level build directory. This can be avoided using this option or calling basis_finalize_targets() at the end of each CMakeLists.txt file. |
BASIS_TYPE
property either an executable or a shared library using the MATLAB Compiler.function basis_add_mex_file | ( | in | TARGET_NAME, |
in | ARGN | ||
) |
Add MEX-file target.
CXX
(i.e., C/C++) and the MEX
type option is given.This function is used to add a shared library target which is built using the MATLAB MEX script (mex).
By default, the BASIS C++ utilities library is added as link dependency. If none of the BASIS C++ utilities are used by this target, the option NO_BASIS_UTILITIES can be given. To enable this option by default, set the variable BASIS_UTILITIES
to FALSE
, best in the Settings.cmake
file located in the PROJECT_CONFIG_DIR
(add such file if missing). If the use of the BASIS C++ utilities is disabled by default, the USE_BASIS_UTILITIES
option can be used to enable them for this target only. Note that the utilities library is a static library and thus the linker would simply not include any of the BASIS utility functions in the final binary file if not used. The only advantage of setting BASIS_UTILITIES
to FALSE
or to always specify NO_BASIS_UTILITIES
if no target uses the utilities is that the BASIS utilities library will not be build in this case.
A custom CMake build target with the following properties is added by this function to the build system. These properties are used by basis_build_mex_target() to generate a build script written in CMake code which is executed by a custom CMake command. Before the invokation of basis_build_mex_target(), the target properties can be modified using basis_set_target_properties().
MFILE file | MATLAB source file with function prototype and documentation of MEX-file. (default: none) |
PREFIX prefix | Output prefix of build MEX-file such as package name (the prefix must include the leading + and trailing /). |
An install command for the added library target is added by this function as well. The MEX-file will be installed as part of the specified COMPONENT
in the INSTALL_LIBRARY_DIR
on Unix and INSTALL_RUNTIME_DIR
on Windows.
[in] | TARGET_NAME | Name of build target. |
[in] | ARGN | The remaining arguments are parsed and the following arguments extracted. All unparsed arguments are treated as the source files of the MEX-file. |
COMPONENT name | Name of installation component as part of which this MEX-file is being installed if the LIBRARY_INSTALL_DIRECTORY property is not "none". (default: BASIS_LIBRARY_COMPONENT ) |
[NO]EXPORT | Whether to export this target. (default: TRUE ) |
NO_BASIS_UTILITIES | Specify that the BASIS utilities are not used by this MEX-file and hence no link dependency on the BASIS utilities shall be added. (default: NOT BASIS_UTILITIES) |
USE_BASIS_UTILITIES | Specify that the BASIS utilities are used and required by this MEX-file and hence a link dependency on the BASIS utilities must be added. (default: BASIS_UTILITIES ) |
FINAL | Finalize custom targets immediately. Any following target property changes will have no effect. When this option is used, the custom target which executes the custom build command is added in the current working directory. Otherwise it will be added in the top-level source directory of the project. Which with the Visual Studio generators adds the corresponding Visual Studio Project files directly to the top-level build directory. This can be avoided using this option or calling basis_finalize_targets() at the end of each CMakeLists.txt file. |
macro basis_add_module_info | ( | in | MODULE_NAME, |
in | F | ||
) |
Manually add project module to list of modules.
function basis_add_perl_utilities_library | ( | out | UID | ) |
Add build target for BASIS Perl utilities library.
This function is called by basis_target_link_libraries() in order to add the "basis" build target for the project-specific BASIS Perl utilities. If the target was added before, it is only used to get the target UID of this build target so the executable or library can be linked to it.
[out] | UID | UID of added build target. |
function basis_add_python_utilities_library | ( | out | UID | ) |
Add build target for BASIS Python utilities library.
This function is called by basis_target_link_libraries() in order to add the "basis" build target for the project-specific BASIS Python utilities. If the target was added before, it is only used to get the target UID of this build target so the executable or library can be linked to it.
[out] | UID | UID of added build target. |
function basis_add_script_library | ( | in | TARGET_NAME, |
in | ARGN | ||
) |
Add script library target.
CXX
(i.e., C/C++) nor MATLAB
.This function adds a build target for libraries which are a collection of one or more modules written in a scripting language. The relative paths of the modules relative to the library's SOURCE_DIRECTORY
property are preserved. This is important for the most widely used scripting languages such as Python, Perl, or MATLAB, where the file path relative to the package root directory defines the package namespace.
A custom CMake build target with the following properties is added by this function to the build system. These properties are used by basis_build_script_library() to generate a build script written in CMake code which is executed by a custom CMake command. Before the invokation of basis_build_script_library(), the target properties can be modified using basis_set_target_properties().
BASIS_TYPE | Read-only property with value "SCRIPT_LIBRARY" for script library targets. |
BASIS_UTILITIES | Whether the BASIS utilities are used by any module of this library. For the supported scripting languages for which BASIS utilities are implemented, BASIS will in most cases automatically detect whether these utilities are used by a module or not. Otherwise, set this property manually or use either the USE_BASIS_UTILITIES or the NO_BASIS_UTILITIES option when adding the library target. (default: auto-detected or UNKNOWN ) |
BINARY_DIRECTORY | Build tree directory of this target. (default: CMAKE_CURRENT_BINARY_DIR ) |
COMPILE | Whether to compile the library, respectively, it's modules if the programming language allows such pre-compilation as in case of Python, for example. If TRUE , only the compiled files are installed. (default: BASIS_COMPILE_SCRIPTS ) |
SCRIPT_DEFINITIONS | CMake code which is evaluated after the inclusion of the default script configuration files. This code can be used to set the replacement text of the CMake variables ("@VAR@" patterns) used in the source files. See Build System Standard for details. (default: "") |
SCRIPT_DEFINITIONS_FILE | CMake script file with compile definitions, also referred to as script configuration file. The named files are included after the default BASIS script configuration and before the SCRIPT_DEFINITIONS code is being evaluated. (default: BINARY_CONFIG_DIR/ScriptConfig.cmake ) |
EXPORT | Whether to export this build target in which case an import library target is added to the custom exports file with the path to the built/installed modules set as IMPORT_LOCATION . (default: TRUE ) |
LANGUAGE | Read-only property of programming language of modules in uppercase letters. (default: see LANGUAGE argument) |
LIBRARY_COMPONENT | Name of component as part of which this library is installed if LIBRARY_INSTALL_DIRECTORY is not set to "none". (default: see COMPONENT argument) |
LIBRARY_INSTALL_DIRECTORY | Installation directory of library configured for use in installation tree relative to CMAKE_INSTALL_PREFIX . Set to "none" (case-insensitive) to skip the addition of an installation rule. (default: INSTALL_<LANGUAGE>_LIBRARY_DIR if defined or INSTALL_LIBRARY_DIR otherwise) |
LIBRARY_OUTPUT_DIRECTORY | Output directory of library configured for use within the build tree. (default: BINARY_<LANGUAGE>_LIBRARY_DIR if defined or BINARY_LIBRARY_DIR otherwise) |
LINK_DEPENDS | Paths or target names of script modules and libraries used by this script. For each listed build target, a dependency is added between this library target and the named build targets. Use basis_target_link_libraries() to add additional link dependencies. Further note that if this library is a link dependency of an executable script added by basis_add_executable() (i.e., basis_add_script() actually), the link dependencies of this library are inherited by the executable script. (default: BASIS utilities module if used or empty list otherwise) |
PREFIX | Common module prefix. The given directory path is appended to both LIBRAR_OUTPUT_DIRECTORY and LIBRARY_INSTALL_DIRECTORY and can, for example, be used to install modules of a Python package as part of another Python package, where LIBRARY_OUTPUT_DIRECTORY or LIBRARY_INSTALL_DIRECTORY , respectively, is the directory of the main package which is added to the PYTHONPATH . Possibly missing init.py files in case of Python are generated by the _initpy target which is automatically added by BASIS in that case and further added to the dependencies of this library target. (default: PROJECT_NAMESPACE_PYTHON if LANGUAGE is PYTHON with periods (.) replaced by slashes (/), PROJECT_NAMESPACE_PERL if LANGUAGE is PERL with :: replaced by slashes (/), and "" otherwise) |
SOURCE_DIRECTORY | Source directory of this target. This directory is in particular used to convert the paths of the given source files to relative paths. The built modules within the build and installation tree will have the same relative path (relative to the LIBRARY_OUTPUT_DIRECTORY or LIBRARY_INSTALL_DIRECTORY , respectively). (default: CMAKE_CURRENT_SOURCE_DIR ) |
SOURCES | Read-only property which lists the source files of this library. Note that the first element in this list actually names a directory in the build, the one where the build script for this target is located instead of a source file and thus should be ignored. |
[in] | TARGET_NAME | Name of build target. |
[in] | ARGN | The remaining arguments are parsed and the following arguments extracted. All unparsed arguments are treated as the module files of the script library. |
COMPONENT name | Name of installation component as part of which this library is being installed if the LIBRARY_INSTALL_DIRECTORY property is not "none". (default: BASIS_LIBRARY_COMPONENT ) |
DESTINATION dir | Installation directory for library relative to CMAKE_INSTALL_PREFIX . If an absolute path is given as argument, it is made relative to the configured installation prefix. (default: INSTALL_LIBRARY_DIR ) |
LANGUAGE lang | Programming language in which modules are written (case-insensitive). If not specified, the programming language is derived from the file name extensions of the source files and the shebang directive on the first line of each module if any. If the programming language could not be detected automatically, the LANGUAGE property is set to UNKNOWN . Note that for script library targets, the library may still be built correctly even if the scripting language was not recognized. The automatic detection whether the BASIS utilities are used and required will fail, however. In this case, specify the programming language using this option. (default: auto-detected or UNKNOWN ) |
[NO]EXPORT | Whether to export this target. (default: TRUE ) |
NO_BASIS_UTILITIES | Specify that the BASIS utilities are not used by this library. If the programming language of the modules is known and BASIS utilities are available for this language, BASIS will in most cases automatically detect whether these utilities are used by any module of this library. Use this option to skip this check in the case that no module makes use of the BASIS utilities. |
USE_BASIS_UTILITIES | Specify that the BASIS utilities are used and thus required by this library. If the programming language of the modules is known and BASIS utilities are available for this language, BASIS will in most cases automatically detect whether these utilities are used by any module of this library. Use this option to skip this check when it is already known that no module makes use of the BASIS utilities. Note that an error is raised if this option is given, but no BASIS utilities are available for the programming language of this script or if the programming language is unknown, respectively, not detected correctly. In this case, consider the use of the LANGUAGE argument. |
FINAL | Finalize custom targets immediately. Any following target property changes will have no effect. When this option is used, the custom target which executes the custom build command is added in the current working directory. Otherwise it will be added in the top-level source directory of the project. Which with the Visual Studio generators adds the corresponding Visual Studio Project files directly to the top-level build directory. This can be avoided using this option or calling basis_finalize_targets() at the end of each CMakeLists.txt file. |
function basis_add_tests_of_default_options | ( | in | TARGET_NAME | ) |
Add tests of default options for given executable.
–helpshort | Short help. The output has to match the regular expression "[Uu]sage:\n\s*\<executable name\>", where <executable name> is the name of the tested executable. |
–help, -h | Help screen. Simply tests if the option is accepted. |
–version | Version information. Output has to include the project version string. |
–verbose, -v | Increase verbosity of output messages. Simply tests if the option is accepted. |
[in] | TARGET_NAME | Name of executable or script target. |
function basis_add_uninstall | ( | ) |
Add uninstall target.
uninstall
and code to cmake_install.cmake
to install an uninstaller. macro basis_add_utilities_library | ( | out | UID, |
in | LANGUAGE | ||
) |
Add build target for BASIS utilities library.
This function is called by basis_target_link_libraries() in order to add the "basis" build target for the project-specific BASIS utilities for a given source code language. If the target was added before, it is only used to get the target UID of this build target so the executable or library can be linked to it.
[out] | UID | UID of added build target. |
[in] | LANGUAGE | Programming language of utilities. |
function basis_append_to_each | ( | in | OUTPUT_LIST, |
in | INPUT_LIST, | ||
in | ITEM_TO_APPEND | ||
) |
basis_append_to_each takes an input list and appends a single element to each item in that list and appends it to the output list. For example, this is useful for adding relative paths to the end of a list of paths.
OUTPUT_LIST | Name of list that will be filled with appended names. |
INPUT_LIST | Name of list that contains items to have text appended. |
ITEM_TO_APPEND | text to append to each item in the input list. |
function basis_build_mcc_target | ( | in | TARGET_UID | ) |
Add custom command for build of MATLAB Compiler target.
This function is called by basis_finalize_targets() which in turn is called by basis_project_end(), i.e., the end of the root CMake configuration file of the (sub-)project.
[in] | TARGET_UID | Name/UID of custom target added by basis_add_mcc_target(). |
function basis_build_mex_file | ( | in | TARGET_UID | ) |
Add custom command for build of MEX-file.
This function is called by basis_finalize_targets() which in turn is called by basis_project_end(), i.e., the end of the root CMake configuration file of the (sub-)project.
[in] | TARGET_UID | Name/UID of custom target added by basis_add_mex_file(). |
function basis_build_script | ( | in | TARGET_UID | ) |
Add custom command for build of single script.
This function is called by basis_finalize_targets() which in turn is called by basis_project_end(), i.e., the end of the root CMake configuration file of the (sub-)project.
[in] | TARGET_UID | Name/UID of custom target added by basis_add_script(). |
function basis_build_script_library | ( | in | TARGET_UID | ) |
Add custom command for build of script library.
This function is called by basis_finalize_targets() which in turn is called by basis_project_end(), i.e., the end of the root CMake configuration file of the (sub-)project.
[in] | TARGET_UID | Name/UID of custom target added by basis_add_script_library(). |
function basis_buildtree_asserts | ( | in | ARGN | ) |
Ensure certain requirements on build tree.
Requirements:
[in] | ARGN | Not used. |
function basis_check_if_module_depends_on_package | ( | out | result, |
in | module, | ||
in | package | ||
) |
Check if named project module depends on the specified package.
[out] | result | Name of boolean return variable. |
[in] | module | Name of project module. |
[in] | package | Name of (external) package. |
result
variable to either TRUE
or FALSE
. function basis_check_if_package_is_needed_by_modules | ( | out | result, |
in | package, | ||
in | ARGN | ||
) |
Check if any of the named/enabled modules depends on the specified package.
[out] | result | Name of boolean return variable. |
[in] | package | Name of (external) package. |
[in] | ARGN | Names of project modules. If none specified, the list of enabled modules is used instead. |
result
variable to either TRUE
or FALSE
. function basis_check_target_name | ( | in | TARGET_NAME | ) |
Checks whether a given name is a valid target name.
Displays fatal error message when target name is invalid.
[in] | TARGET_NAME | Desired target name. |
function basis_check_test_name | ( | in | TEST_NAME | ) |
Checks whether a given name is a valid test name.
Displays fatal error message when test name is invalid.
[in] | TEST_NAME | Desired test name. |
macro basis_compare_lists | ( | out | RESULT, |
in | LIST1, | ||
in | LIST2 | ||
) |
Compare two lists.
[out] | RESULT | Result of comparison. |
[in] | LIST1 | Name of variable holding the first list. |
[in] | LIST2 | Name of varaible holding the second list. |
0 | The two lists are not identical. |
1 | Both lists have identical elements (not necessarily in the same order). |
macro basis_compile_python_modules_for_jython | ( | out | FLAG | ) |
Whether to compile Python modules for Jython interpreter.
This macro returns a boolean value stating whether Python modules shall also be compiled for use by Jython interpreter if BASIS_COMPILE_SCRIPTS is ON.
[out] | FLAG | Set to either TRUE or FALSE depending on whether Python modules shall be compiled using Jython or not. |
function basis_configure_public_headers | ( | ) |
Configure public header files.
macro basis_configure_root_documentation_files | ( | ) |
Configure root documentation files.
The root documentation files are located in the top-level directory of the project's source tree. These are, in particular, the
AUTHORS.txt
or AUTHORS.md file with information on the authors of the software,COPYING.txt
or COPYING.md file with copyright and licensing information,README.txt
or README.md file,INSTALL.txt
or INSTALL.md file with build and installation instructions,WELCOME.txt
or WELCOME.md file with text used as welcome text of the installer. where the top-level project requires all of these files except of the WELCOME.txt
or WELCOME.md file which defaults to the readme file. Modules of a project usually do not include any of these files. Otherwise, the content of the module's documentation file is appended to the corresponding file of the top-level project. function basis_configure_script | ( | in | INPUT, |
in | OUTPUT, | ||
in | ARGN | ||
) |
Configure and optionally compile script file.
This function is used to configure script files during the build. It is called by the build script generated by basis_add_script_target() for each script target. It is also used to configure the modules of the packages implemented in supported scripting languages which are located in the PROJECT_LIBRARY_DIR
of the source tree.
In case of executable scripts, this function automatically prepends the module search paths such that the modules of this software package are found (and preferred in case of potential name conflicts with other packages). Moreover, it adds (or replaces) the shebang directive on Unix such that the configured interpreter version is used. On Windows, it converts the executable script into a Windows Command instead which executes the proper interpreter with the code section of the input script.
[in] | INPUT | Input script file. |
[in] | OUTPUT | Configured output script file. |
[in] | ARGN | Optional arguments: |
COMPILE | Whether to compile module scripts if suitable, i.e., an intermediate format exists for the specific scripting language. For example, Python modules can be compiled. | CONFIGURATION name | Name of build configuration. |
COPYONLY | Whether to only copy the script file without replacing CMake variables within the file. This option is passed on to CMake's configure_file() command used to configure the script file. By default, the option @ONLY is used instead. | ||
EXECUTABLE | Specifies that the given script file is an executable script and not a module script. Otherwise, if this option is not given and the output file name contains a file name extension, the given script file is configured as module script. A script file with an output file name that has no extension, is always considered to be an executable. | ||
DIRECTORY dir | Build tree directory of configured script. By default, the directory of the output script file is used to set the DIR variable used to make absolute file paths relative to the configured build tree script file in the script configuration file (see basis_set_script_path()). | ||
DESTINATION dir | Installation directory for configured script. If this option is given, the BUILD_INSTALL_SCRIPT variable is set to TRUE before including any specified script configuration files (see CONFIG_FILE option). Moreover, the DIR variable is set to the specified directory. Otherwise, if this option is omitted, the BUILD_INSTALL_SCRIPT variable is set to FALSE instead and DIR is set to the directory of the configured OUTPUT file. Note that the BUILD_INSTALL_SCRIPT and DIR variables are in particular used by basis_set_script_path() to convert the given paths to paths relative to the location of the configured/installed script. | ||
CACHE_FILE file1 [file2...] | List of CMake files with dump of variables which should be included before configuring the script. The cache files can be generated using the basis_dump_variables() function. | ||
CONFIG_FILE file1 [file2...] | List of script configuration files to include before the configuration of the script. See also the documentation of the DESTINATION option. | ||
LINK_DEPENDS dep1 [dep2...] | List of "link" dependencies, i.e., modules and script/module libraries required by this script. For executable scripts, the paths to these modules/packages is added to the module search path. If the prefix "relative " is given before a file path, it is made relative to the output/installation directory of the script file. All given input paths must be absolute, however, as the relative location depends on whether the script will be installed, i.e., the DESTINATION is specified, or not. |
function basis_configure_script_libraries | ( | ) |
Add library targets for the public modules in PROJECT_LIBRARY_DIR
.
This function configures ("builds") the library modules in the PROJECT_LIBRARY_DIR
that are written in a scripting language such as Python or Perl. The names of the added library targets can be modified using the BASIS_<LANG>_LIBRARY_TARGET
variables, which are set to their default values in the BasisSettings.cmake
file.
function basis_configure_sources | ( | out | LIST_NAME, |
in | ARGN | ||
) |
Configure .in source files.
This function configures each source file in the given argument list with a .in file name suffix and stores the configured file in the build tree with the same relative directory as the template source file itself. The first argument names the CMake variable of the list of configured source files where each list item is the absolute file path of the corresponding (configured) source file.
[out] | LIST_NAME | Name of output list. |
[in] | ARGN | These arguments are parsed and the following options recognized. All remaining arguments are considered to be source file paths. |
BINARY_DIRECTORY | Explicitly specify directory in build tree where configured source files should be written to. |
KEEP_DOT_IN_SUFFIX | By default, after a source file with the .in extension has been configured, the .in suffix is removed from the file name. This can be omitted by giving this option. |
function basis_configure_utilities | ( | ) |
Configure BASIS utilities.
This function configures the following source files which can be used within the source code of the project. If the BASIS utilities for a specific language are not used by any of the project's build targets, no target for the build of these utilities is added, unless the BUILD_BASIS_UTILITIES_FOR_<LANGUAGE>
option is set to ON
. A reason for forcing the build of the BASIS utilities is that the libraries should be used by other projects which may want to make use of the BASIS Utilities to get access to the project attributes.
basis.h | Header file declaring the BASIS utilities for C++. |
basis.cxx | Definitions of the constants and functions declared in basis.h. |
basis.py | Module defining the BASIS utilities for Python. |
Basis.pm | Module defining the BASIS utilities for Perl. |
basis.sh | Module defining the BASIS utilities for Bash. |
function basis_create_addpaths_mfile | ( | ) |
This function writes a MATLAB M-file with addpath() statements.
This function writes an MATLAB M-file into the top directory of the build tree which contains an addpath() statement for each directory that was added via basis_include_directories().
function basis_disable_testing_if_no_tests | ( | ) |
Disable testing if project does not implement any tests.
This function checks if there are test/ subdirectories in the project and disables and hides the BUILD_TESTING option if none are found.
function basis_dump_variables | ( | in | RESULT_FILE | ) |
Output current CMake variables to file.
macro basis_exists_target | ( | out | RESULT_VARIABLE, |
in | TARGET_NAME | ||
) |
Whether a given target exists.
This function should be used instead of the if(TARGET) command of CMake because target names are mapped by BASIS to target UIDs.
[out] | RESULT_VARIABLE | Boolean result variable. |
[in] | TARGET_NAME | Name which to check whether it is a target. |
function basis_export_build_properties | ( | in | CODE | ) |
Add code to set properties of imported targets for build tree.
function basis_export_footer | ( | in | CODE | ) |
Add footer of exports file.
function basis_export_header | ( | in | CODE | ) |
Generate header of exports file.
function basis_export_import_targets | ( | in | CODE | ) |
Add code to add import targets.
function basis_export_install_properties | ( | in | CODE | ) |
Add code to set properties of imported targets for installation.
function basis_export_prefix | ( | in | CODE | ) |
Add code to compute prefix relative to INSTALL_CONFIG_DIR
.
function basis_export_targets | ( | ) |
Export all targets added by basis_add_* commands.
function basis_finalize_targets | ( | in | ARGN | ) |
Finalize custom targets by adding the missing build commands.
This function is called by basis_project_end() in order to finalize the addition of the custom build targets such as, for example, build targets for the build of executable scripts, Python packages, MATLAB Compiler executables and shared libraries, and MEX-files. It can, however, also be called explicitly either at the end of each CMakeLists.txt file that adds new build targets or with the name of the target(s) to finalize in some of the CMakeLists.txt files. This is to ensure that the custom target which executes the actual build command is added in the same directory as the original custom target with the respective target properties.
[in] | ARGN | List of targets to finalize. If none specified, all custom targets that were added before and are not finalized already will be finalized using the current binary directory. |
function basis_find_logo | ( | in | OUTPUT_VARIABLE, |
in | SPECIFIED_LOGO, | ||
in | DEFAULT_NAME | ||
) |
Find standard project logo files with standardized PROJECT_${LOGO_TYPE}_LOGO
variable names This is an internal function not designed for general use.
OUTPUT_VARIABLE | the name of the variable that will contain the final |
SPECIFIED_LOGO | the value that is already set for the logo |
DEFAULT_NAME | the default filename of the logo |
macro basis_find_packages | ( | ) |
Find packages this project depends on.
function basis_get_bash_version | ( | out | ARGV1 | ) |
Get version of Bash interpreter.
[out] | ARGV1 | If given, the named variable is set to the version string of the Bash interpreter. Otherwise, the variables BASH_VERSION_STRING , BASH_VERSION_MAJOR , BASH_VERSION_MINOR , and BASH_VERSION_PATCH are set in the scope of the caller. |
function basis_get_build_timestamp | ( | in | TIMESTAMP | ) |
Get build time stamp.
The build time stamp is used as an alternative to the version and revision information in PROJECT_RELEASE
if version is invalid, i.e., set to 0.0.0 as is the case for development branches, and now revision from a revision control system is available.
function basis_get_compiled_file | ( | out | CFILE, |
in | SOURCE, | ||
in | ARGV2 | ||
) |
Get file name of compiled script.
[out] | CFILE | File path of compiled script file. |
[in] | SOURCE | Script source file. |
[in] | ARGV2 | Language of script file. If not specified, the language is derived from the file name extension and shebang of the script source file. |
macro basis_get_compiled_jython_file_of_python_module | ( | out | CFILE, |
in | MODULE | ||
) |
Get file path of Jython file compiled from the given Python module.
Python modules are also compiled using Jython. This macro returns the file path of the compiled Jython file in the build tree which corresponds to the specified Python module.
[out] | CFILE | Path of corresponding compiled Jython file. |
[in] | MODULE | Path of input Python module in build tree. |
function basis_get_full_matlab_version | ( | out | VERSION | ) |
Determine version of MATLAB installation.
[out] | VERSION | Value returned by the "version" command of MATLAB or an empty string if execution of MATLAB failed. |
VERSION
to the full MATLAB version. function basis_get_fully_qualified_target_uid | ( | out | TARGET_UID, |
in | TARGET_NAME | ||
) |
Get fully-qualified target name.
This function always returns a fully-qualified target UID, no matter if the option BASIS_USE_TARGET_UIDS
or BASIS_USE_FULLY_QUALIFIED_UIDS
is OFF
. Note that if BASIS_USE_FULLY_QUALIFIED_UIDS
is ON
, the returned target UID may not be the actual name of a CMake target.
[out] | TARGET_UID | Fully-qualified target UID. |
[in] | TARGET_NAME | Target name used as argument to BASIS CMake functions. |
function basis_get_fully_qualified_test_uid | ( | out | TEST_UID, |
in | TEST_NAME | ||
) |
Get "global" test name, i.e., actual CTest test name.
This function always returns a fully-qualified test UID, no matter if the option BASIS_USE_FULLY_QUALIFIED_UIDS
is OFF
. Note that if this option is ON
, the returned test UID may not be the actual name of a CMake test.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TEST_UID
to the given TEST_NAME
.
[out] | TEST_UID | Fully-qualified test UID. |
[in] | TEST_NAME | Test name used as argument to BASIS CMake functions. |
function basis_get_jython_version | ( | out | ARGV1 | ) |
Get version of Jython interpreter.
[out] | ARGV1 | If given, the named variable is set to the version string of the Jython interpreter. Otherwise, the variables JYTHON_VERSION_STRING , JYTHON_VERSION_MAJOR , JYTHON_VERSION_MINOR , and JYTHON_VERSION_PATCH are set in the scope of the caller. |
function basis_get_matlab_release | ( | out | ARGV1 | ) |
Get release version of MATLAB installation.
[out] | ARGV1 | If given, the named variable is set to the release string of the MATLAB installation, e.g., "R2009b". Otherwise, the variable MATLAB_RELEASE is set in the scope of the caller. |
function basis_get_matlab_version | ( | out | ARGV1 | ) |
Get version of MATLAB installation.
[out] | ARGV1 | If given, the named variable is set to the version string ("<major>.<minor>.<patch>") of the MATLAB installation. Otherwise, the variables MATLAB_VERSION_STRING , MATLAB_VERSION_MAJOR , MATLAB_VERSION_MINOR , MATLAB_VERSION_PATCH , and MATLAB_RELEASE are set in the scope of the caller. |
function basis_get_module_info | ( | in | MODULE_NAME, |
in | F, | ||
in | ARGN | ||
) |
function basis_get_perl_version | ( | out | ARGV1 | ) |
Get version of Perl interpreter.
[out] | ARGV1 | If given, the named variable is set to the version string of the Perl interpreter. Otherwise, the variables PERL_VERSION_STRING , PERL_VERSION_MAJOR , PERL_VERSION_MINOR , and PERL_VERSION_PATCH are set in the scope of the caller. |
function basis_get_project_property | ( | out | VARIABLE, |
in | ARGN | ||
) |
Get project-global property value.
Example:
[out] | VARIABLE | Name of result variable. |
[in] | ARGN | See the example uses. The optional second argument is either the name of the project similar to CMake's get_target_property() command or the keyword PROPERTY followed by the name of the property. |
function basis_get_project_uses_utilities | ( | in | RETVAL | ) |
Determine whether this project uses any of the BASIS Utilities.
macro basis_get_property | ( | in | ARGN | ) |
function basis_get_python_version | ( | out | ARGV1 | ) |
Get version of Python interpreter.
[out] | ARGV1 | If given, the named variable is set to the version string of the Python interpreter. Otherwise, the variables PYTHON_VERSION_STRING , PYTHON_VERSION_MAJOR , PYTHON_VERSION_MINOR , and PYTHON_VERSION_PATCH are set in the scope of the caller. |
function basis_get_revision | ( | in | URL, |
out | REV | ||
) |
Get revision of file or directory.
[in] | URL | Absolute path to directory or single file. |
[out] | REV | Revision number when directory / repository or file was last modified, "0" is returned when no known revision control system is used or revision command not found. |
function basis_get_soname | ( | out | SONAME, |
in | OBJFILE | ||
) |
Get soname of object file.
This function extracts the soname from object files in the ELF format on systems where the objdump command is available. On all other systems, an empty string is returned.
[out] | SONAME | The soname of the object file. |
[in] | OBJFILE | Object file in ELF format. |
function basis_get_source_language | ( | out | LANGUAGE, |
in | ARGN | ||
) |
Detect programming language of given source code files.
This function determines the programming language in which the given source code files are written. If no common programming language could be determined, "AMBIGUOUS" is returned. If none of the following programming languages could be determined, "UNKNOWN" is returned: CXX (i.e., C++), JAVA, MATLAB, PYTHON, JYTHON, PERL, BASH, BATCH.
[out] | LANGUAGE | Detected programming language. |
[in] | ARGN | List of source code files. |
function basis_get_source_target_name | ( | out | TARGET_NAME, |
in | SOURCE_FILE, | ||
in | ARGN | ||
) |
Derive target name from source file name.
[out] | TARGET_NAME | Target name. |
[in] | SOURCE_FILE | Source file. |
[in] | ARGN | Third argument to get_filename_component(). If not specified, the given path is only sanitized. |
SOURCE_FILE
. function basis_get_target_link_libraries | ( | out | LINK_DEPENDS, |
in | TARGET_NAME | ||
) |
Get link libraries/dependencies of (imported) target.
This function recursively adds the dependencies of the dependencies as well and returns them together with the list of the direct link dependencies. Moreover, for script targets, if any of the dependencies uses the BASIS utilities for the given language (BASIS_UTILITIES
property), the corresponding utilities library is added to the list of dependencies. Note that therefore the BASIS utilities targets have to be added already, which is only the case during the finalization of script targets.
[out] | LINK_DEPENDS | List of all link dependencies. In case of scripts, the dependencies are the required modules or paths to required packages, respectively. |
[in] | TARGET_NAME | Name of the target. |
function basis_get_target_location | ( | out | VAR, |
in | TARGET_NAME, | ||
in | PART | ||
) |
Get location of build target output file(s).
This convenience function can be used to get the full path of the output file(s) generated by a given build target. It is similar to the read-only LOCATION
property of CMake targets and should be used instead of reading this porperty. In case of scripted libraries, this function returns the path of the root directory of the library that has to be added to the module search path.
[out] | VAR | Path of build target output file. |
[in] | TARGET_NAME | Name of build target. |
[in] | PART | Which file name component of the LOCATION property to return. See get_filename_component(). If POST_INSTALL_RELATIVE is given as argument, VAR is set to the path of the installed file relative to the installation prefix. Similarly, POST_INSTALL sets VAR to the absolute path of the installed file post installation. |
LOCATION
property of CMake targets.function basis_get_target_name | ( | out | TARGET_NAME, |
in | TARGET_UID | ||
) |
Get "local" target name, i.e., BASIS target name without check of UID.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_NAME
to the given TARGET_UID
.
[out] | TARGET_NAME | Target name used as argument to BASIS functions. |
[in] | TARGET_UID | "Global" target name, i.e., actual CMake target name. |
TARGET_NAME
to the name of the build target with UID TARGET_UID
.If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_NAME
to the given TARGET_UID
.
[out] | TARGET_NAME | Target name used as argument to BASIS functions. |
[in] | TARGET_UID | "Global" target name, i.e., actual CMake target name. |
TARGET_NAME
to the name of the build target with UID TARGET_UID
.function basis_get_target_namespace | ( | out | TARGET_NS, |
in | TARGET_UID | ||
) |
Get namespace of build target without check of UID.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_NS
to an empty string.
[out] | TARGET_NS | Namespace part of target UID. |
[in] | TARGET_UID | Target UID. Get namespace of build target. |
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_NS
to an empty string.
[out] | TARGET_NS | Namespace part of target UID. |
[in] | TARGET_UID | Target UID/name. |
function basis_get_target_type | ( | out | TYPE, |
in | TARGET_NAME | ||
) |
Get type name of target.
[out] | TYPE | The target's type name or NOTFOUND. |
[in] | TARGET_NAME | The name of the target. |
function basis_get_target_uid | ( | out | TARGET_UID, |
in | TARGET_NAME | ||
) |
Get "global" target name, i.e., actual CMake target name.
In order to ensure that CMake target names are unique across modules of a BASIS project, the target name given to the BASIS CMake functions is converted by basis_make_target_uid() into a so-called target UID which is used as actual CMake target name. This function can be used to get for a given target name or UID the closest match of a known target UID.
The individual parts of the target UID, i.e, package name, module name, and target name are separated by a dot (.). If BASIS_USE_FULLY_QUALIFIED_UIDS
is set to OFF
, the common part of all target UIDs is removed by this function from the target UID. When the target is exported, however, this common part will be prefixed again. This is done by the basis_export_targets() function.
Note that names of imported targets are not prefixed in any case.
The counterpart basis_get_target_name() can be used to convert the target UID back to the target name without namespace prefix.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_UID
to the given TARGET_NAME
.
[out] | TARGET_UID | "Global" target name, i.e., actual CMake target name. |
[in] | TARGET_NAME | Target name used as argument to BASIS CMake functions. |
TARGET_UID
to the UID of the build target TARGET_NAME
.function basis_get_test_name | ( | out | TEST_NAME, |
in | TEST_UID | ||
) |
Get "local" test name, i.e., BASIS test name.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TEST_NAME
to the given TEST_UID
.
[out] | TEST_NAME | Test name used as argument to BASIS functions. |
[in] | TEST_UID | "Global" test name, i.e., actual CTest test name. |
TEST_NAME
to the name of the test with UID TEST_UID
.function basis_get_test_namespace | ( | out | TEST_NS, |
in | TEST_UID | ||
) |
Get namespace of test.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TEST_NS
to an empty string.
[out] | TEST_NS | Namespace part of test UID. If TEST_UID is no UID, i.e., does not contain a namespace part, the namespace of this project is returned. |
[in] | TEST_UID | Test UID/name. |
function basis_get_test_uid | ( | out | TEST_UID, |
in | TEST_NAME | ||
) |
Get "global" test name, i.e., actual CTest test name.
In order to ensure that CTest test names are unique across BASIS projects, the test name used by a developer of a BASIS project is converted by this function into another test name which is used as actual CTest test name.
The function basis_get_test_name() can be used to convert the unique test name, the test UID, back to the original test name passed to this function.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TEST_UID
to the given TEST_NAME
.
[out] | TEST_UID | "Global" test name, i.e., actual CTest test name. |
[in] | TEST_NAME | Test name used as argument to BASIS CMake functions. |
TEST_UID
to the UID of the test TEST_NAME
.function basis_git_get_revision | ( | in | URL, |
out | REV, | ||
in | ARGN | ||
) |
Get HEAD commit SHA of file or directory.
[in] | URL | Absolute path to repository directory or single file. |
[out] | REV | The short commit SHA when URL was last modified. If URL is not under Git control or GIT_EXECUTABLE is invalid, "0" is returned. |
[in] | ARGN | Length of commit SHA to return. |
REV
either to the HEAD commit SHA of the repository at directory URL
or the last commit which modified the file. macro basis_initialize_settings | ( | ) |
Initialize project settings.
function basis_install_links | ( | ) |
Adds installation rules to create default symbolic links.
This function creates for each main executable a symbolic link directly in the directory INSTALL_PREFIX/bin
if INSTALL_SINFIX
is TRUE and the software is installed on a Unix-like system, i.e., one which supports the creation of symbolic links.
macro basis_install_public_headers | ( | ) |
Add installation rules for public header files.
function basis_install_template | ( | in | TEMPLATE, |
in | DESTINATION | ||
) |
Add installation rule for project template.
function basis_installtree_asserts | ( | in | ARGN | ) |
Ensure certain requirements on install tree.
Requirements:
[in] | ARGN | Not used. |
macro basis_is_cached | ( | out | VAR, |
in | ENTRY | ||
) |
Determine if cache entry exists.
[out] | VAR | Name of boolean result variable. |
[in] | ENTRY | Name of cache entry. |
function basis_is_git_repository | ( | in | FLAG, |
in | DIR | ||
) |
function basis_join | ( | in | VALUES, |
in | DELIMITER, | ||
out | OUTPUT | ||
) |
Concatenates all list elements into a single delimited string.
[in] | VALUES | Input list string. |
[in] | DELIMITER | Delimiter glue used to separate list elements. Each element which contains the delimiter as substring is surrounded by double quotes (") in the output string. |
[out] | OUTPUT | Output string variable name. |
OUTPUT
to the resulting string.macro basis_library_prefix | ( | out | PREFIX, |
in | LANGUAGE | ||
) |
Get default subdirectory prefix of scripted library modules.
[out] | PREFIX | Name of variable which is set to the default library prefix, i.e., subdirectory relative to the library root directory as used for the PREFIX property of scripted module libraries (see basis_add_script_library()) or relative to the include directory in case of C++. Note that this prefix includes a trailing slash to indicate that the prefix is a subdirectory. |
[in] | LANGUAGE | Programming language (case-insenitive), e.g., CXX , Python , Matlab ... |
function basis_list_to_delimited_string | ( | out | STR, |
in | DELIM, | ||
in | ARGN | ||
) |
Concatenates all list elements into a single delimited string.
[out] | STR | Output string. |
[in] | DELIM | Delimiter used to separate list elements. Each element which contains the delimiter as substring is surrounded by double quotes (") in the output string. |
[in] | ARGN | Input list. If this list starts with the argument NOAUTOQUOTE , the automatic quoting of list elements which contain the delimiter is disabled. |
STR
to the resulting string.macro basis_list_to_regex | ( | out | REGEX, |
in | ARGN | ||
) |
Convert list into regular expression.
This function is in particular used to convert a list of property names such as <CONFIG>_OUTPUT_NAME, e.g., the list BASIS_PROPERTIES_ON_TARGETS
, into a regular expression which can be used in pattern matches.
[out] | REGEX | Name of variable for resulting regular expression. |
[in] | ARGN | List of patterns which may contain placeholders in the form of "<this is a placeholder>". These are replaced by the regular expression "[^ ]+". |
function basis_list_to_string | ( | out | STR, |
in | ARGN | ||
) |
Concatenates all list elements into a single string.
The list elements are concatenated without any delimiter in between. Use basis_list_to_delimited_string() to specify a delimiter such as a whitespace character or comma (,) as delimiter.
[out] | STR | Output string. |
[in] | ARGN | Input list. |
STR
to the resulting string.function basis_make_target_uid | ( | out | TARGET_UID, |
in | TARGET_NAME | ||
) |
Make target UID from given target name.
This function is intended for use by the basis_add_*() functions only.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TARGET_UID
to the given TARGET_NAME
.
[out] | TARGET_UID | "Global" target name, i.e., actual CMake target name. |
[in] | TARGET_NAME | Target name used as argument to BASIS CMake functions. |
TARGET_UID
to the UID of the build target TARGET_NAME
.function basis_make_test_uid | ( | out | TEST_UID, |
in | TEST_NAME | ||
) |
Make test UID from given test name.
This function is intended for use by the basis_add_test() only.
If BASIS_USE_TARGET_UIDS
is set to OFF
, this operation always just sets the TEST_UID
to the given TEST_NAME
.
[out] | TEST_UID | "Global" test name, i.e., actual CTest test name. |
[in] | TEST_NAME | Test name used as argument to BASIS CMake functions. |
TEST_UID
to the UID of the test TEST_NAME
.function basis_mexext | ( | out | ARGN | ) |
Determine extension of MEX-files for this architecture.
[out] | ARGN | The first argument ARGV0 is set to the extension of MEX-files (excluding '.'). If the CMake variable MEX_EXT is set, its value is returned. Otherwise, this function tries to determine it from the system information. If the extension could not be determined, an empty string is returned. If no argument is given, the extension is cached as the variable MEX_EXT. |
macro basis_module_enable | ( | in | MODULE, |
in | NEEDED_BY | ||
) |
function basis_normalize_name | ( | out | OUT, |
in | STR | ||
) |
Convert string to lowercase only or mixed case.
Strings in all uppercase or all lowercase are converted to all lowercase letters because these are usually used for acronymns. All other strings are returned unmodified with the one exception that the first letter has to be uppercase for mixed case strings.
This function is in particular used to normalize the project name for use in installation directory paths and namespaces.
[out] | OUT | String in CamelCase. |
[in] | STR | String. |
function basis_process_generator_expressions | ( | out | ARGS, |
in | ARGN | ||
) |
Process generator expressions in arguments.
This command evaluates the $<TARGET_FILE:tgt> and related generator expressions also for custom targets such as scripts and MATLAB Compiler targets. For other generator expressions whose argument is a target name, this function replaces the target name by the target UID, i.e., the actual CMake target name such that the expression can be evaluated by CMake. The following generator expressions are directly evaluated by this function:
$<TARGET_FILE:tgt> | Absolute file path of built target. |
$<TARGET_FILE_POST_INSTALL:tgt> | Absolute path of target file after installation using the current CMAKE_INSTALL_PREFIX . |
$<TARGET_FILE_POST_INSTALL_RELATIVE:tgt> | Path of target file after installation relative to CMAKE_INSTALL_PREFIX . |
Additionally, the suffix _NAME
or _DIR
can be appended to the name of each of these generator expressions to get only the basename of the target file including the extension or the corresponding directory path, respectively.
Generator expressions are in particular supported by basis_add_test().
[out] | ARGS | Name of output list variable. |
[in] | ARGN | List of arguments to process. |
macro basis_project_initialize | ( | ) |
Initialize project, calls CMake's project() command.
PROJECT_REVISION | Revision number of Subversion controlled source tree or 0 if the source tree is not under revision control. |
PROJECT_RELEASE | A string of project version and revision that can be used for the output of version information. The format of this string is either one of the following:
|
macro basis_project_modules | ( | ) |
Initialize project modules.
Most parts of this macro were copied from the ITK4 project (http://www.vtk.org/Wiki/ITK_Release_4), in particular, the top-level CMakeLists.txt file. This file does not state any specific license, but the ITK package itself is released under the Apache License Version 2.0, January 2004 (http://www.apache.org/licenses/).
function basis_register_package | ( | ) |
Register installed package with CMake.
This function adds an entry to the CMake registry for packages with the path of the directory where the package configuration file is located in order to help CMake find the package.
The uninstaller whose template can be found in cmake_uninstaller.cmake.in is responsible for removing the registry entry again.
macro basis_remove_blank_line | ( | in | STRVAR | ) |
Remove one blank line from top of string.
macro basis_sanitize_for_regex | ( | out | OUT, |
in | STR | ||
) |
Sanitize string variable for use in regular expression.
This takes all of the dollar signs, and other special characters and adds escape characters such as backslash as necessary.
[out] | OUT | String that can be used in regular expression. |
[in] | STR | String to sanitize. |
macro basis_set_config_option | ( | out | VAR, |
in | OPT | ||
) |
Set value of variable to either 0 or 1 based on option value.
This function can be used to convert option values from TRUE/ON to 1 and FALSE/OFF to 0 such that they can be used to configure a config.h.in header.
[out] | VAR | Name of configuration header variable. |
[in] | OPT | Value of CMake option. |
macro basis_set_flag | ( | in | PREFIX, |
out | FLAG, | ||
in | DEFAULT | ||
) |
Set flag given mutually exclusive ARGN_<FLAG> and ARGN_NO<FLAG> function arguments.
[in] | PREFIX | Prefix of function arguments. Set to the first argument of the CMAKE_PARSE_ARGUMENTS() command. |
[out] | FLAG | Name of flag. |
[in] | DEFAULT | Default flag value if neither ARGN_<FLAG;gt; nor ARGN_NO<FLAG;gt; evaluates to true. |
macro basis_set_if_empty | ( | out | VAR, |
in | ARGN | ||
) |
Set value of variable only if variable is not set already.
[out] | VAR | Name of variable. |
[in] | ARGN | Arguments to set() command excluding variable name. |
VAR
if its value was not valid before. macro basis_set_if_not_set | ( | out | VAR, |
in | ARGN | ||
) |
Set value of variable only if variable is not defined yet.
[out] | VAR | Name of variable. |
[in] | ARGN | Arguments to set() command excluding variable name. |
VAR
if it was not defined before. macro basis_set_or_update_type | ( | in | VAR, |
in | TYPE, | ||
in | ARGN | ||
) |
Set type of variable.
If the variable is cached, the type is updated, otherwise, a cache entry of the given type with the current value of the variable is added.
[in] | VAR | Name of variable. |
[in] | TYPE | Desired type of variable. |
[in] | ARGN | Optional DOC string used if variable was not cached before. |
macro basis_set_or_update_value | ( | in | VAR | ) |
Set variable value.
If the variable is cached, this function will update the cache value, otherwise, it simply sets the CMake variable uncached to the given value(s).
function basis_set_project_property | ( | ) |
Set project-global property.
Set property associated with current project/module. The property is in fact just a cached variable whose name is prefixed by the project's name.
macro basis_set_property | ( | in | ARGN | ) |
function basis_set_target_install_rpath | ( | in | TARGET_NAME | ) |
Set INSTALL_RPATH property of executable or shared library target.
This function sets the INSTALL_RPATH
property of a specified executable or shared library target using the LINK_DEPENDS
obtained using the basis_get_target_link_libraries() function. It determines the installation location of each dependency using the basis_get_target_location() function.
INSTALL_RPATH
property of the specified target.macro basis_slicer_module_initialize | ( | ) |
Initialize slicer module meta-data.
At the moment, only one module, most often the top-level project can be a Slicer module, i.e., call basis_slicer_module() either in the BasisProject.cmake file of the top-level project or in the corresponding file of at most one of the project modules.
function basis_slicer_module_to_extension_metadata | ( | ) |
Copy MODULE_* metadata to EXTENSION_* metadata of Slicer Extension.
This function is required to work-around bug 1901 in Slicer 4.1.0. It basically implements what the SlicerBlockModuleToExtensionMetadata.cmake module which can be found in the Extensions/CMake/ directory of the Slicer 4 source tree is implementing. The list of metadata has been copied from this particular CMake module of the 4.1.0 release of Slicer.
function basis_string_to_list | ( | out | LST, |
in | STR | ||
) |
Splits a string at space characters into a list.
[out] | LST | Output list. |
[in] | STR | Input string. |
LST
to the resulting CMake list. function basis_strip_target_uid | ( | inout | TARGET_UID | ) |
Strip of top-level package name from target UID if present.
If BASIS_USE_FULLY_QUALIFIED_TARGET_UID
is ON
, the top-level package name is always preserved and this operation does nothing.
[in,out] | TARGET_UID | "Global" target name, i.e., actual CMake target name. |
TARGET_UID
to the (stripped) UID. function basis_svn_get_last_changed_revision | ( | in | URL, |
out | REV | ||
) |
Get revision number when directory or file was last changed.
[in] | URL | Absolute path to directory or file. May also be a URL to the directory or file in the repository. A leading "file://" is automatically removed such that the svn command treats it as a local path. |
[out] | REV | Revision number when URL was last modified. If URL is not under Subversion control or Subversion_SVN_EXECUTABLE is invalid, "0" is returned. |
REV
to revision number at which the working copy/repository specified by the URL URL
was last modified. function basis_svn_get_revision | ( | in | URL, |
out | REV | ||
) |
Get current revision of file or directory.
[in] | URL | Absolute path to directory or file. May also be a URL to the directory or file in the repository. A leading "file://" is automatically removed such that the svn command treats it as a local path. |
[out] | REV | The revision number of URL. If URL is not under revision control or Subversion_SVN_EXECUTABLE is invalid, "0" is returned. |
REV
to the revision of the working copy/repository at URL URL
. function basis_svn_status | ( | in | URL, |
out | STATUS | ||
) |
Get status of revision controlled file.
[in] | URL | Absolute path to directory or file. May also be a URL to the directory or file in the repository. A leading "file://" will be removed such that the svn command treats it as a local path. |
[out] | STATUS | The status of URL as returned by 'svn status'. If the local directory or file is unmodified, an empty string is returned. An empty string is also returned when Subversion_SVN_EXECUTABLE is invalid. |
STATUS
to the output of the svn info
command. function basis_tokenize_dependency | ( | in | DEP, |
out | PKG, | ||
out | VER, | ||
out | CMP | ||
) |
Tokenize dependency specification.
This function parses a dependency specification such as "ITK-4.1{TestKernel,IO}" into the package name, i.e., ITK, the requested (minimum) package version(s), i.e., 4.1, and a list of package components, i.e., TestKernel and IO. A valid dependency specification must specify the package name of the dependency (case-sensitive). The version and components specification are optional. Note that the components specification may be separated by an arbitrary number of whitespace characters including newlines. The same applies to the specification of the components themselves. This allows one to format the dependency specification as follows, for example:
VTK-7|6{}
[in] | DEP | Dependency specification, i.e., "<Pkg>[-<version>[|...]][{<Component1>[,...]}]". |
[out] | PKG | Package name. |
[out] | VER | Package version(s). |
[out] | CMP | List of package components. |
function basis_update_imported_location | ( | in | TARGET, |
in | PROPERTY, | ||
in | LOCATION | ||
) |
Update location of imported target.
[in] | TARGET | Name (UID) of the imported target. |
[in] | PROPERTY | Target location property. Either IMPORTED_LOCATION or IMPORTED_LOCATION_<config>, where <config> is one of the imported build configurations. This argument is used to decide whether to keep the current target information or to replace it by the new one. |
[in] | LOCATION | Location of imported target. |
function basis_update_imported_type | ( | in | TARGET, |
in | TYPE | ||
) |
Update type of imported target.
This function is in particular called in basis_set_target_properties() if the BASIS_TYPE property of custom BASIS targets is set after the imported target was added with the initial type UNKNOWN.
[in] | TARGET | Name (UID) of the imported target. |
[in] | TYPE | Type of imported target. |
macro basis_update_type_of_variable | ( | in | VAR, |
in | TYPE | ||
) |
Change type of cached variable.
If the variable is not cached, nothing is done.
macro basis_update_value | ( | in | VAR | ) |
Update cache variable.
function basis_utilities_check | ( | out | VAR, |
in | SOURCE_FILE, | ||
in | ARGN | ||
) |
Check whether the BASIS utilities are used within a given source file.
This function matches the source code against specific import patterns which are all valid imports of the BASIS utilities for the respective programming language of the specified file. If the BASIS utilities are used within the specified source file, the variable named VAR
is set to TRUE
. Otherwise, it is set to FALSE
.
[out] | VAR | Whether the BASIS utilites are used. |
[in] | SOURCE_FILE | Path of source file to check. |
[in] | ARGN | Source code language. If not specified, the programming language is determined automatically. |
function basis_variable_check | ( | in | ARGN | ) |
Checks for a list of variables required later in the script.
Produces a clear error message explaining the problem and how to fix it if they are not present.
[in] | ARGN | This argument list is parsed and the following arguments are extracted. |
REQUIRED var... | List of variables that MUST be set to run this script correctly. Will produce a FATAL_ERROR message explaining which variables are misisng and exit the cmake script. |
OPTIONAL var... | List of variables need not be set to run this script correctly. |
PATH_EXISTS var... | List of path variables that MUST be set to a location that exists. |
OPTIONAL_PATH_EXISTS var... | List of path variables that are optional, but once set must be empty or provide a path to location that exists. |
function basis_variable_value_status | ( | out | VAR_INFO_STRING, |
in | ARGN | ||
) |
Create a string from a list of variables indicating if they are defined and their values.
Useful for debug and user errors, for example:
[out] | VAR_INFO_STRING | The output string variable that will set with the debug string. |
[in] | ARGN | List of variables to be put into a string along with their value. |
function basis_version_numbers | ( | in | VERSION, |
out | MAJOR, | ||
out | MINOR, | ||
out | PATCH | ||
) |
Extract version numbers from version string.
[in] | VERSION | Version string in the format "MAJOR[.MINOR[.PATCH]]". |
[out] | MAJOR | Major version number if given or 0. |
[out] | MINOR | Minor version number if given or 0. |
[out] | PATCH | Patch number if given or 0. |
[out] parameters. macro basis_write_addpaths_mfile | ( | in | MFILE, |
in | ARGN | ||
) |
This function writes a MATLAB M-file with addpath() statements.
[in] | MFILE | Name of M-file. |
[in] | ARGN | The remaining arguments are the paths which should be added to the search path of MATLAB when this M-file is being executed. If the option APPEND is given, the paths are appended to the specified M-file. Otherwise, any existing file will be overwritten. The given directory paths can be relative, in which case they are interpreted relative to the location of the written M-file using the mfilename() function of MATLAB. |
function basis_write_list | ( | in | FILENAME, |
in | VARIABLE | ||
) |
Write CMake script file which sets the named variable to the specified (list of) values.
macro find_package | ( | ) |
Overloaded find_package() command.
This macro calls CMake's find_package() command and converts obsolete all uppercase "<PKG>_<VAR>" variables to case-sensitive "<Pkg>_<VAR>" variables. It further ensures that the global variables CMAKE_FIND_LIBRARY_SUFFIXES and CMAKE_FIND_EXECUTABLE_SUFFIX are reset to the values they had before the call to find_package(). This is required if the "Find<Pkg>.cmake" module has modified these variables, but not restored their initial value.
function get_filename_component | ( | inout | ARGN | ) |
Fixes CMake's get_filename_component() command.
The get_filename_component() command of CMake returns the entire portion after the first period (.) [including the period] as extension. However, only the component following the last period (.) [including the period] should be considered to be the extension.
[in,out] | ARGN | Arguments as accepted by get_filename_component(). |
macro include_directories | ( | in | ARGN | ) |
Add directories to search path for include files.
Overwrites CMake's include_directories() command. This is required because the basis_include_directories() function is not used by other projects in their package use files. Therefore, this macro is an alias for basis_include_directories().
[in] | ARGN | List of arguments for basis_include_directories(). |
macro link_directories | ( | in | ARGN | ) |
Add directories to search path for libraries.
Overwrites CMake's link_directories() command. This is required because the basis_link_directories() function is not used by other projects in their package use files. Therefore, this macro is an alias for basis_link_directories().
[in] | ARGN | List of arguments for basis_link_directories(). |
function set_target_properties | ( | in | ARGN | ) |
Set target property.
This function is overwritten by BASIS in order to update the information about imported build targets.
PROPERTIES
keyword, only properties listed in BASIS_PROPERTIES_ON_TARGETS
can be set.[in] | ARGN | List of arguments for set_target_properties(). |
option BUILD_ALL_MODULES = OFF |
Definition at line 1083 of file ProjectTools.cmake.
cmake CONFIG_FILE |
Name of the CMake package configuration file.
Definition at line 47 of file GenerateConfig.cmake.
cmake CONFIG_PREFIX |
Package name.
Definition at line 45 of file GenerateConfig.cmake.
cmake CUSTOM_EXPORTS_FILE |
Name of the CMake target exports file for custom targets.
Definition at line 55 of file GenerateConfig.cmake.
cmake EXPORTS_FILE |
Name of the CMake target exports file.
Definition at line 53 of file GenerateConfig.cmake.
cmake msg |
Definition at line 1210 of file ProjectTools.cmake.
cmake PROJECT_MODULES_DISABLED |
Definition at line 1147 of file ProjectTools.cmake.
cmake PROJECT_MODULES_ENABLED |
Definition at line 1146 of file ProjectTools.cmake.
cmake PROJECT_MODULES_SORTED |
Definition at line 1172 of file ProjectTools.cmake.
cmake USE_FILE |
Name of the CMake package use file.
Definition at line 51 of file GenerateConfig.cmake.
cmake VERSION_FILE |
Name of the CMake package version file.
Definition at line 49 of file GenerateConfig.cmake.