.\" Man page generated from reStructuredText. . .TH "YCM-MODULES" "7" "Jan 15, 2021" "0.12." "YCM" .SH NAME ycm-modules \- YCM Modules Reference . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH GENERIC MODULES .SS ExtractVersion .sp Extracts version numbers from a version string: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C extract_version ( [REVERSE_NAME]) .ft P .fi .UNINDENT .UNINDENT .sp Tries to extract the following variables (the second version is used if REVERSE_NAME is set as argument): .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C _MAJOR_VERSION or _VERSION_MAJOR \- major version _MINOR_VERSION or _VERSION_MINOR \- minor version _PATCH_VERSION or _VERSION_PATCH \- patch version _TWEAK_VERSION or _VERSION_TWEAK \- tweak version _VERSION_COUNT \- number of version components, 0 to 4 .ft P .fi .UNINDENT .UNINDENT .SS GetAllCMakeProperties .sp Return a list containing the names of all known CMake Properties. .sp Only properties returned by \fBcmake \-\-help\-property\-list\fP are returned, custom properties will not be on the returned list. .sp Properties containing \fB\fP or \fB\fP are expanded to the correct property name. .SS GitInfo .sp Extract information from a git repository. .INDENT 0.0 .TP .B git_commit_info Extract information about one commit from one git repository in \fBSOURCE DIR\fP: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C git_commit_info([SOURCE DIR ] [PREFIX ] [REVISION ] [FATAL]) .ft P .fi .UNINDENT .UNINDENT .sp If \fBSOURCE_DIR\fP is a git repository, it checks the given \fBREVISION\fP and sets the following variables: .INDENT 7.0 .TP .B \fB_GIT_COMMIT_DESCRIBE\fP The output of \fBgit describe \fP\&. .TP .B \fB_GIT_COMMIT_DESCRIBE_CONTAINS\fP The output of \fBgit describe \-\-contains \fP\&. .TP .B \fB_GIT_COMMIT_TAG\fP The most recent tag that is reachable from a commit. .TP .B \fB_GIT_COMMIT_REVISION\fP The number of commits since the beginning of the git history. .TP .B \fB_GIT_COMMIT_TAG_REVISION\fP The number of commits since the last tag. .TP .B \fB_GIT_COMMIT_DATE_REVISION\fP The number of commits since the beginning of the day. .TP .B \fB_GIT_COMMIT_AUTHOR_DATE\fP The commit author date. .TP .B \fB_GIT_COMMIT_AUTHOR_TIME\fP The commit author time. .TP .B \fB_GIT_COMMIT_AUTHOR_TZ\fP The commit author time zone. .TP .B \fB_GIT_COMMIT_AUTHOR_NAME\fP The commit author name. .TP .B \fB_GIT_COMMIT_AUTHOR_EMAIL\fP The commit author e\-mail. .TP .B \fB_GIT_COMMIT_COMMITTER_DATE\fP The commit committer date. .TP .B \fB_GIT_COMMIT_COMMITTER_TIME\fP The commit author time. .TP .B \fB_GIT_COMMIT_COMMITTER_TZ\fP The commit author time zone. .TP .B \fB_GIT_COMMIT_COMMITTER_NAME\fP The commit committer name. .TP .B \fB_GIT_COMMIT_COMMITTER_EMAIL\fP The commit committer email. .TP .B \fB_GIT_COMMIT_HASH\fP The commit hash. .TP .B \fB_GIT_COMMIT_HASH_SHORT\fP The abbreviated commit hash. .TP .B \fB_GIT_COMMIT_SUBJECT\fP The commit log message subject line. .TP .B \fB_GIT_COMMIT_BODY\fP The commit log message body. .UNINDENT .sp If \fBSOURCE_DIR\fP is not set, then the \fBPROJECT_SOURCE_DIR\fP cmake variable is used. .sp If \fBPREFIX\fP is not set, then the \fBPROJECT_NAME\fP cmake variable is used. .sp \fBREVISION\fP can be a commit hash, a tag, a branch, or anything that git can parse as a revision. If \fBREVISION\(ga is not set, then \(ga\(gaHEAD\fP is used. .sp If \fBFATAL\fP is set, a fatal error is emitted when the source dir is not a git repository, or when git was not found. This is disabled by default to allow downloads from non\-git sources (archives, wrappers, etc.), but can be enabled if required. .UNINDENT .INDENT 0.0 .TP .B git_wt_info Extract information about current working tree from one git repository in \fBSOURCE DIR\fP: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C git_wt_info([SOURCE DIR ] [PREFIX ] [FATAL]) .ft P .fi .UNINDENT .UNINDENT .sp If \fBSOURCE_DIR\fP is a git repository, it checks current revision and sets the following variables: .INDENT 7.0 .TP .B \fB_GIT_WT_DESCRIBE\fP The output of \fBgit describe HEAD\fP\&. .TP .B \fB_GIT_WT_DESCRIBE_CONTAINS\fP The output of \fBgit describe \-\-contains HEAD\fP\&. .TP .B \fB_GIT_WT_TAG\fP The most recent tag that is reachable from current commit. .TP .B \fB_GIT_WT_REVISION\fP The number of commits since the beginning of the git history. .TP .B \fB_GIT_WT_TAG_REVISION\fP The number of commits since the last tag. .TP .B \fB_GIT_WT_DATE_REVISION\fP The number of commits since the beginning of the day. .TP .B \fB_GIT_WT_AUTHOR_DATE\fP The current commit author date. .TP .B \fB_GIT_WT_AUTHOR_TIME\fP The current commit author time. .TP .B \fB_GIT_WT_AUTHOR_TZ\fP The current commit author time zone. .TP .B \fB_GIT_WT_AUTHOR_NAME\fP The current commit author name. .TP .B \fB_GIT_WT_AUTHOR_EMAIL\fP The current commit author e\-mail. .TP .B \fB_GIT_WT_COMMITTER_DATE\fP The current commit committer date. .TP .B \fB_GIT_WT_COMMITTER_TIME\fP The current commit author time. .TP .B \fB_GIT_WT_COMMITTER_TZ\fP The current commit author time zone. .TP .B \fB_GIT_WT_COMMITTER_NAME\fP The current commit committer name. .TP .B \fB_GIT_WT_COMMITTER_EMAIL\fP The current commit committer email. .TP .B \fB_GIT_WT_HASH\fP The current commit hash. .TP .B \fB_GIT_WT_HASH_SHORT\fP The abbreviated commit hash. .TP .B \fB_GIT_WT_SUBJECT\fP The current commit log message subject line. .TP .B \fB_GIT_WT_BODY\fP The current commit log message body. .TP .B \fB_GIT_WT_DIRTY\fP Whether the current working tree is clean or not. .UNINDENT .sp If \fBSOURCE_DIR\fP is not set, then the \fBPROJECT_SOURCE_DIR\fP cmake variable is used. .sp If \fBPREFIX\fP is not set, then the \fBPROJECT_NAME\fP cmake variable is used. .sp If \fBFATAL\fP is set, a fatal error is emitted when the source dir is not a git repository, or when git was not found. This is disabled by default to allow downloads from non\-git sources (archives, wrappers, etc.), but can be enabled if required. .UNINDENT .SS IncludeUrl .sp Adds the \fI\%include_url()\fP command that useful to download and include other CMake modules from a given url. .INDENT 0.0 .TP .B include_url .UNINDENT .sp Downloads a file from given url and includes it: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C include_url( # Url to be downloaded [DESTINATION ] # Where the file will be saved [EXPECTED_HASH ] # Verify downloaded file\(aqs hash [EXPECTED_MD5 ] # Short\-hand for "EXPECTED_HASH MD5=sum" [DOWNLOAD_ONCE] # Download the file only once [DOWNLOAD_ALWAYS] # Download the file every time [OPTIONAL] # Do not fail file cannot be included [RESULT_VARIABLE ] # The local path for the file included [RETRIES ] # Try download times (default 3) [QUIET] # Don\(aqt print anything #\-\-Download arguments\-\-\-\-\-\-\-\-\-\-\- [INACTIVITY_TIMEOUT ] # Timeout after seconds of inactivity [TIMEOUT ] # Timeout after seconds [STATUS ] # Download status variable [LOG ] # Download log variable [SHOW_PROGRESS] # Show download progress [TLS_VERIFY ] # Check certificates [TLS_CAINFO ] # Custom Certificate Authority file #\-\-Include arguments\-\-\-\-\-\-\-\-\-\-\-\- [NO_POLICY_SCOPE] # Do not manage a new policy entry ) .ft P .fi .UNINDENT .UNINDENT .sp The \fBinclude_url\fP macro downloads a file from given url and includes it. It works both in \-P script mode and when configuring a CMakeLists.txt file. .sp If \fBDESTINATION\fP is specified, the file is saved at the given location with the original file name, if \fB\fP is a directory, or with the given file name, if \fB\fP is a file name. .sp The arguments \fBEXPECTED_HASH\fP, \fBEXPECTED_MD5\fP are used to ensure that the file included is the one expected. If the \fB\fP is a local file (i.e. starts with \fBfile://\fP) the hash check is performed also on the file converted to the non\-native end\-of\-line style. See the documentation of the \fI\%file()\fP command for further information about these arguments. .sp If the \fBDOWNLOAD_ONCE\fP option is specified, the file is not downloaded if the file already exists and the hash is correct. If the \fBDOWNLOAD_ALWAYS\fP option is specified, the file is downloaded at every CMake execution, and an error is raised on failure. If none of these two option is specifies, the default behaviour is to try to download the file at every CMake execution, but no error is raised if the download fails if a version of the file already exists. This is useful when CMake should try to update the file to the latest version, before including it. .sp If the \fBOPTIONAL\fP option is specified, no error will be caused if for any reason the file cannot be downloaded or included. If \fBRESULT_VARIABLE\fP is given, the variable will be set to the full filename which has been downloaded and included or NOTFOUND if it failed. See the documentation of the \fI\%file()\fP command for further information about these arguments. .sp If the \fBRETRIES\fP option is specified, the download will be tried If the \fBQUIET\fP option is specified, the command will emit no output. .sp The arguments \fBINACTIVITY_TIMEOUT\fP, \fBTIMEOUT\fP, \fBSTATUS\fP, \fBLOG\fP, \fBSHOW_PROGRESS\fP, \fBTLS_VERIFY\fP, and \fBTLS_CAINFO\fP are passed to the \fI\%file(DOWNLOAD)\fP command. See the documentation of the \fI\%file()\fP command for a detailed description of these arguments. .sp The arguments \fBNO_POLICY_SCOPE\fP is passed to the \fI\%include()\fP command. See the documentation of the \fI\%include()\fP and \fI\%cmake_policy()\fP commands for a detailed description of this argument. .SS ReplaceImportedTargets .sp Adds the \fI\%replace_imported_targets()\fP command that useful to replace paths with imported targets in link variables (like \fB_LIBRARIES\fP) and targets. .INDENT 0.0 .TP .B replace_imported_targets .UNINDENT .sp Replace imported targets in a list of and targets and paths: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C replace_imported_targets( [target [target [...]]]) .ft P .fi .UNINDENT .UNINDENT .sp Each path in \fBvar\fP corrisponding to one of the \fBtargets\fP will be replaced with the corrisponding \fBtarget\fP, taking care to remove the relative \fBoptimized\fP and \fBdebug\fP keywords. .sp For each existing target in \fBvar\fP, the following properties will be searched for imported locations of targets, and, if set, will be replaced in the same way: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_DEPENDENT_LIBRARIES_ IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_LIBRARIES_ INTERFACE_LINK_LIBRARIES LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_ LINK_LIBRARIES .ft P .fi .UNINDENT .UNINDENT .SS StandardFindModule .sp Try to find a package using a cmake config file, or pkgconfig: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C standard_find_module( [NOT_REQUIRED] [QUIET] [SKIP_CMAKE_CONFIG] [SKIP_PKG_CONFIG] [TARGET ] [REPLACE_TARGETS [...]] ) .ft P .fi .UNINDENT .UNINDENT .sp If the package is found, the following variables (where possible) are created: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C _FOUND \- System has _INCLUDE_DIRS \- include directory _LIBRARIES \- libraries _DEFINITIONS \- Additional compiler flags for _VERSION \- version _MAJOR_VERSION \- major version _MINOR_VERSION \- minor version _PATCH_VERSION \- patch version _TWEAK_VERSION \- tweak version _VERSION_COUNT \- Number of version components, 0 to 4 .ft P .fi .UNINDENT .UNINDENT .sp For each library that requires to be linked (i.e. \fB\-llib\fP) it creates: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C __LIBRARY_RELEASE (cached, advanced) __LIBRARY_DEBUG (cached, advanced, and empty by default) __LIBRARY __LIBRARY_FOUND .ft P .fi .UNINDENT .UNINDENT .sp In a \fBFindXXX.cmake\fP module, this macro can be used at the beginning. The \fBNOT_REQUIRED\fP can be added to avoid failing if the package was not found, but \fBpkg\-config\fP is installed. The \fBQUIET\fP argument can be used to hide the output from \fIfind_package_handle_standard_args\fP\&. If \fB_FOUND\fP is \fBFALSE\fP at the end, more “custom” searches can be used (for windows, etc.) .sp If \fBSKIP_CMAKE_CONFIG\fP or \fBSKIP_PKG_CONFIG\fP are set, the relative step is skipped .sp If \fBTARGET\fP is specified, in \fBpkg\-config\fP mode, an imported target will be created using the first library returned by \fBpkg\-config\fP as imported location. .sp The \fBREPLACE_TARGETS\fP can be used to pass a list of imported targets that will be detected in variables and target properties, and replaced with the corresponding target. .sp If one of the \fBSTANDARD_FIND_MODULE_USE_IMPORTED_TARGET\fP or \fBSTANDARD_FIND_MODULE_USE_IMPORTED_TARGET_\fP are enabled, and a \fBTARGET\fP is specified, the \fB_LIBRARIES\fP variable content is replaced with the imported target. .sp If one of the variables \fBSTANDARD_FIND_MODULE_DEBUG\fP or \fBSTANDARD_FIND_MODULE_DEBUG_\fP is enabled, prints more useful debug output .SH PACKAGING HELPER MODULES .SS InstallBasicPackageFiles .sp A helper module to make your package easier to be found by other projects. .INDENT 0.0 .TP .B install_basic_package_files .UNINDENT .sp Create and install a basic version of cmake config files for your project: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C install_basic_package_files( COMPATIBILITY [VERSION ] [ARCH_INDEPENDENT] [NO_EXPORT | EXPORT ] # (default = "EXPORT ") [NO_SET_AND_CHECK_MACRO] [NO_CHECK_REQUIRED_COMPONENTS_MACRO] [VARS_PREFIX ] # (default = "") [EXPORT_DESTINATION ] [INSTALL_DESTINATION ] [NAMESPACE ] # (default = "::") [EXTRA_PATH_VARS_SUFFIX path1 [path2 ...]] [CONFIG_TEMPLATE ] [UPPERCASE_FILENAMES | LOWERCASE_FILENAMES] [DEPENDENCIES " [...]" ...] [PRIVATE_DEPENDENCIES " [...]" ...] [INCLUDE_FILE | INCLUDE_CONTENT ] [COMPONENT ] # (default = "") ) .ft P .fi .UNINDENT .UNINDENT .sp Depending on \fBUPPERCASE_FILENAMES\fP and \fBLOWERCASE_FILENAMES\fP, this function generates 3 files: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fBConfigVersion.cmake\fP or \fB\-config\-version.cmake\fP .IP \(bu 2 \fBConfig.cmake\fP or \fB\-config.cmake\fP .IP \(bu 2 \fBTargets.cmake\fP or \fB\-targets.cmake\fP .UNINDENT .UNINDENT .UNINDENT .sp If neither \fBUPPERCASE_FILENAMES\fP nor \fBLOWERCASE_FILENAMES\fP is set, a file \fBConfig.cmake.in\fP or \fB\-config.cmake.in\fP is searched, and the convention is chosed according to the file found. If no file was found, the uppercase convention is used. .sp The \fBDEPENDENCIES\fP argument can be used to set a list of dependencies that will be searched using the \fBfind_dependency()\fP command from the \fI\%CMakeFindDependencyMacro\fP module. Dependencies can be followed by any of the possible \fBfind_dependency()\fP argument. In this case, all the arguments must be specified within double quotes (e.g. \fB" 1.0.0 EXACT"\fP, or \fB" CONFIG"\fP). The \fBPRIVATE_DEPENDENCIES\fP argument is similar to \fBDEPENDENCIES\fP, but these dependencies are included only when \fI\%BUILD_SHARED_LIBS\fP is \fBOFF\fP\&. If a libraries is declared \fBSTATIC\fP, \fBOBJECT\fP or \fBINTERFACE\fP, and they link to some dependency, these should be added using the \fBDEPENDENCIES\fP argument, since the \fBPRIVATE_DEPENDENCIES\fP argument would work only when \fI\%BUILD_SHARED_LIBS\fP is disabled. .sp When using a custom template file, the \fB@PACKAGE_DEPENDENCIES@\fP string is replaced with the code checking for the dependencies specified by these two argument. .sp If the \fBARCH_INDEPENDENT\fP option is enabled, the installed package version will be considered compatible even if it was built for a different architecture than the requested architecture. .sp Each file is generated twice, one for the build directory and one for the installation directory. The \fBINSTALL_DESTINATION\fP argument can be passed to install the files in a location different from the default one (\fB${CMAKE_INSTALL_DATADIR}/cmake/${Name}\fP if the \fBARCH_INDEPENDENT\fP option is enabled, \fB${CMAKE_INSTALL_LIBDIR}/cmake/${Name}\fP otherwise). The \fBEXPORT_DESTINATION\fP argument can be passed to generate the files in the build tree in a location different from the default one (\fBCMAKE_BINARY_DIR\fP). If this is a relative path, it is considered relative to the \fBCMAKE_CURRENT_BINARY_DIR\fP directory. .sp The build directory is exported to the CMake user package registry if the build option \fBCMAKE_EXPORT_PACKAGE_REGISTRY\fP is set. .sp The \fBConfigVersion.cmake\fP file is generated using \fBwrite_basic_package_version_file()\fP\&. The \fBVERSION\fP, \fBCOMPATIBILITY\fP, and .nf \(ga\(ga .fi ARCH_INDEPENDENT\(ga\(gaarguments are passed to this function. .sp \fBVERSION\fP shall be in the form \fB[.[.[.]]]]\fP\&. If no \fBVERSION\fP is given, the \fBPROJECT_VERSION\fP variable is used. If this hasn’t been set, it errors out. The \fBVERSION\fP argument is also used to replace the \fB@PACKAGE_VERSION@\fP string in the configuration file. .sp \fBCOMPATIBILITY\fP shall be any of the options accepted by the \fBwrite_basic_package_version_file()\fP command (\fBAnyNewerVersion\fP, \fBSameMajorVersion\fP, \fBSameMinorVersion\fP [CMake 3.11], or \fBExactVersion\fP). These options are explained in \fBwrite_basic_package_version_file()\fP command documentation. If your project has more elaborate version matching rules, you will need to write your own custom ConfigVersion.cmake file instead of using this macro. .sp The \fBConfig.cmake\fP file is generated using \fBconfigure_package_config_file()\fP\&. The \fBNO_SET_AND_CHECK_MACRO\fP, \fBNO_CHECK_REQUIRED_COMPONENTS_MACRO\fP, and arguments are passed to this function. .sp By default \fI\%install_basic_package_files()\fP also generates the two helper macros \fBset_and_check()\fP and \fBcheck_required_components()\fP into the \fBConfig.cmake\fP file. \fBset_and_check()\fP should be used instead of the normal \fI\%set()\fP command for setting directories and file locations. Additionally to setting the variable it also checks that the referenced file or directory actually exists and fails with a \fBFATAL_ERROR\fP otherwise. This makes sure that the created \fBConfig.cmake\fP file does not contain wrong references. When using the \fBNO_SET_AND_CHECK_MACRO, this macro is not generated into the \(ga\(gaConfig.cmake\fP file. .sp By default, \fI\%install_basic_package_files()\fP append a call to \fBcheck_required_components()\fP in \fBConfig.cmake\fP file if the package supports components. This macro checks whether all requested, non\-optional components have been found, and if this is not the case, sets the \fB_FOUND\fP variable to \fBFALSE\fP, so that the package is considered to be not found. It does that by testing the \fB__FOUND\fP variables for all requested required components. When using the \fBNO_CHECK_REQUIRED_COMPONENTS_MACRO\fP option, this macro is not generated into the \fBConfig.cmake\fP file. .sp Finally, the files in the build and install directory are exactly the same. .sp See the documentation of \fI\%CMakePackageConfigHelpers\fP module for further information and references therein. .sp If the \fBCONFIG_TEMPLATE\fP argument is passed, the specified file is used as template for generating the configuration file, otherwise this module expects to find a \fBConfig.cmake.in\fP or \fB\-config.cmake.in\fP file either in current source directory. If the file does not exist, a very basic file is created. .sp A set of variables are checked and passed to \fBconfigure_package_config_file()\fP as \fBPATH_VARS\fP\&. For each of the \fBSUFFIX\fP considered, if one of the variables: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C _(BUILD|INSTALL)_ (BUILD|INSTALL)__ .ft P .fi .UNINDENT .UNINDENT .sp is defined, the \fB_\fP variable will be defined before configuring the package. In order to use that variable in the config file, you have to add a line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set_and_check(_ \e"@PACKAGE__@\e") .ft P .fi .UNINDENT .UNINDENT .sp if the path must exist or just: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C set(_ \e"@PACKAGE__@\e") .ft P .fi .UNINDENT .UNINDENT .sp if the path could be missing. .sp These variable will have different values whether you are using the package from the build tree or from the install directory. Also these files will contain only relative paths, meaning that you can move the whole installation and the CMake files will still work. .sp Default \fBPATH_VARS\fP suffixes are: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C BINDIR BIN_DIR SBINDIR SBIN_DIR LIBEXECDIR LIBEXEC_DIR SYSCONFDIR SYSCONF_DIR SHAREDSTATEDIR SHAREDSTATE_DIR LOCALSTATEDIR LOCALSTATE_DIR LIBDIR LIB_DIR INCLUDEDIR INCLUDE_DIR OLDINCLUDEDIR OLDINCLUDE_DIR DATAROOTDIR DATAROOT_DIR DATADIR DATA_DIR INFODIR INFO_DIR LOCALEDIR LOCALE_DIR MANDIR MAN_DIR DOCDIR DOC_DIR .ft P .fi .UNINDENT .UNINDENT .sp more suffixes can be added using the \fBEXTRA_PATH_VARS_SUFFIX\fP argument. .sp The \fBTargets.cmake\fP is generated using \fI\%export(EXPORT)\fP in the build tree and \fI\%install(EXPORT)\fP in the installation directory. The targets are exported using the value for the \fBNAMESPACE\fP argument as namespace. The export can be passed using the \fBEXPORT\fP argument. If no export is used (e.g. for a CMake script library), pass \fBNO_EXPORT\fP\&. .sp If the \fBINCLUDE_FILE\fP argument is passed, the content of the specified file (which might contain \fB@variables@\fP) is appended to the generated \fBConfig.cmake\fP file. If the \fBINCLUDE_CONTENT\fP argument is passed, the specified content (which might contain \fB@variables@\fP) is appended to the generated \fBConfig.cmake\fP file. When a \fBCONFIG_TEMPLATE\fP is passed, or a \fBConfigVersion.cmake.in\fP or a \fB\-config\-version.cmake.in file is available, these 2 arguments are used to replace the \(ga\(ga@INCLUDED_CONTENT@\fP string in this file. This allows one to inject custom code to this file, useful e.g. to set additional variables which are loaded by downstream projects. .sp Note that content specified with \fBINCLUDE_FILE\fP or \fBINCLUDE_CONTENT\fP cannot reference any of the \fBPATH_VARS\fP because this content is not expanded by \fBconfigure_package_config_file()\fP\&. .sp If the \fBCOMPONENT\fP argument is passed, it is forwarded to the \fI\%install()\fP commands, otherwise \fB\fP is used. .SS AddUninstallTarget .sp Add the “uninstall” target for your project: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C include(AddUninstallTarget) .ft P .fi .UNINDENT .UNINDENT .sp will create a file \fBcmake_uninstall.cmake\fP in the build directory and add a custom target \fBuninstall\fP (or \fBUNINSTALL\fP on Visual Studio and Xcode) that will remove the files installed by your package (using \fBinstall_manifest.txt\fP). See also \fI\%https://gitlab.kitware.com/cmake/community/wikis/FAQ#can\-i\-do\-make\-uninstall\-with\-cmake\fP .sp The \fI\%AddUninstallTarget\fP module must be included in your main \fBCMakeLists.txt\fP\&. If included in a subdirectory it does nothing. This allows you to use it safely in your main \fBCMakeLists.txt\fP and include your project using \fBadd_subdirectory\fP (for example when using it with \fBFetchContent\fP). .sp If the \fBuninstall\fP target already exists, the module does nothing. .SS AddInstallRPATHSupport .sp Add support to RPATH during installation to the project and the targets .INDENT 0.0 .TP .B add_install_rpath_support Add support to RPATH during installation to the project: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C \&.. code\-block:: cmake .ft P .fi .UNINDENT .UNINDENT .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .TP .B add_install_rpath_support([BIN_DIRS dir [dir]] [LIB_DIRS dir [dir]] [INSTALL_NAME_DIR [dir]] [DEPENDS condition [condition]] [USE_LINK_PATH]) .UNINDENT .UNINDENT .UNINDENT .sp Normally (depending on the platform) when you install a shared library you can either specify its absolute path as the install name, or leave just the library name itself. In the former case the library will be correctly linked during run time by all executables and other shared libraries, but it must not change its install location. This is often the case for libraries installed in the system default library directory (e.g. \fB/usr/lib\fP). In the latter case, instead, the library can be moved anywhere in the file system but at run time the dynamic linker must be able to find it. This is often accomplished by setting environmental variables (i.e. \fBLD_LIBRARY_PATH\fP on Linux). This procedure is usually not desirable for two main reasons: .INDENT 7.0 .IP \(bu 2 by setting the variable you are changing the default behaviour of the dynamic linker thus potentially breaking executables (not as destructive as \fBLD_PRELOAD\fP) .IP \(bu 2 the variable will be used only by applications spawned by the shell and not by other processes. .UNINDENT .sp RPATH aims in solving the issues introduced by the second installation method. Using run\-path dependent libraries you can create a directory structure containing executables and dependent libraries that users can relocate without breaking it. A run\-path dependent library is a dependent library whose complete install name is not known when the library is created. Instead, the library specifies that the dynamic loader must resolve the library’s install name when it loads the executable that depends on the library. The executable or the other shared library will hardcode in the binary itself the additional search directories to be passed to the dynamic linker. This works great in conjunction with relative paths. This command will enable support to RPATH to your project. It will enable the following things: .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 If the project builds shared libraries it will generate a run\-path enabled shared library, i.e. its install name will be resolved only at run time. .IP \(bu 2 In all cases (building executables and/or shared libraries) dependent shared libraries with RPATH support will have their name resolved only at run time, by embedding the search path directly into the built binary. .UNINDENT .UNINDENT .UNINDENT .sp The command has the following parameters: .INDENT 7.0 .TP .B Options: .INDENT 7.0 .IP \(bu 2 \fBUSE_LINK_PATH\fP: if passed the command will automatically adds to the RPATH the path to all the dependent libraries. .UNINDENT .TP .B Arguments: .INDENT 7.0 .IP \(bu 2 \fBBIN_DIRS\fP list of directories when the targets (executable and plugins) will be installed. .IP \(bu 2 \fBLIB_DIRS\fP list of directories to be added to the RPATH. These directories will be added “relative” w.r.t. the \fBBIN_DIRS\fP and \fBLIB_DIRS\fP\&. .IP \(bu 2 \fBINSTALL_NAME_DIR\fP directory where the libraries will be installed. This variable will be used only if \fBCMAKE_SKIP_RPATH\fP or \fBCMAKE_SKIP_INSTALL_RPATH\fP is set to \fBTRUE\fP as it will set the \fBINSTALL_NAME_DIR\fP on all targets .IP \(bu 2 \fBDEPENDS\fP list of conditions that should be \fBTRUE\fP to enable RPATH, for example \fBFOO; NOT BAR\fP\&. .UNINDENT .UNINDENT .sp Note: see \fI\%https://gitlab.kitware.com/cmake/cmake/issues/16589\fP for further details. .UNINDENT .INDENT 0.0 .TP .B target_append_install_rpath Add extra paths to RPATH for a specific target: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C \&.. code\-block:: cmake .ft P .fi .UNINDENT .UNINDENT .INDENT 7.0 .INDENT 3.5 .INDENT 0.0 .TP .B target_append_install_rpath( [LIB_DIRS dir [dir]] [DEPENDS condition [condition]]) .UNINDENT .UNINDENT .UNINDENT .INDENT 7.0 .TP .B Arguments: .INDENT 7.0 .IP \(bu 2 \fBINSTALL_DESTINATION\fP path where the target will be installed. .IP \(bu 2 \fBLIB_DIRS\fP list of directories to be added to the RPATH. These directories will be added “relative” w.r.t. the \fBINSTALL_DESTINATION\fP\&. .IP \(bu 2 \fBDEPENDS\fP list of conditions that should be \fBTRUE\fP to enable RPATH, for example \fBFOO; NOT BAR\fP\&. .UNINDENT .UNINDENT .UNINDENT .SH SUPERBUILD HELPER MODULES .SS FindOrBuildPackage .sp Searches for a package and builds it if it cannot be found. .INDENT 0.0 .TP .B find_or_build_package .UNINDENT .sp Searches for a package and builds it if it cannot be found: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C find_or_build_package( ) .ft P .fi .UNINDENT .UNINDENT .sp This module tries to locate a package using \fI\%find_package()\fP\&. If the package cannot be found it tries to build it, by including \fBBuild\fP\&. This file should contain the instructions to download and build the package (for example using \fBExternalProject\fP) .sp The arguments passed to the function, are passed to the \fI\%find_package()\fP command. .sp FIXME Figure out how to handle the REQUIRED and QUIET arguments .sp If the package was found, the \fBUSE_SYSTEM_\fP cached variable can be disabled in order to force CMake to build the package instead of using the one found on the system. To automatically force CMake to build all the packages that are also found on the system, the \fBYCM_DISABLE_SYSTEM_PACKAGES\fP cache variable can be enabled. .sp This function sets these variables: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C HAVE_SYSTEM_ # The package was found on the system HAVE_ # The package is available .ft P .fi .UNINDENT .UNINDENT .sp The user should use the latest, to check if a package is available, instead of checking using \fB_FOUND\fP\&. For example .sp FIXME Check uppercase (${_PKG}) and lowercase (${_pkg}) variables .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C find_or_build_package(Foo) if(HAVE_Foo) ... endif() .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B CMAKE_DISABLE_BUILD_PACKAGE_ .UNINDENT .sp Using this variable, building a package is explicitly forbidden. therefore if the package cannot be found on the system, the \fBHAVE_\fP will be set to false. .SS YCMEPHelper .sp A helper for \fBExternalProject\fP: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C ycm_ep_helper( [DOCS] [TYPE ] [STYLE