![]() ![]() No packaging required Simply add all external sources as a dependency.Just add the script to your project and you're good to go. Plug-and-play No need to install anything.Recursive dependencies Ensures that no dependency is added twice and all are added in the minimum required version.Reproducible builds By versioning dependencies via git commits or tags it is ensured that a project will always be buildable. ![]() Cross-Platform CPM adds projects directly at the configure stage and is compatible with all CMake toolchains and generators.Small and reusable projects CPM takes care of all project dependencies, allowing developers to focus on creating small, well-tested libraries.To update CPM to the newest version, update the script in the project's root directory, for example by running the same command as for adding CPM.ĭependencies using CPM will automatically use the updated script of the outermost project. The function CPMFindPackage will try to find a local dependency via CMake's find_package and fallback to CPMAddPackage, if the dependency is not found. In rare cases, this behaviour may be desirable by default. CPM_LAST_PACKAGE_NAME is set to the determined name of the last added dependency (equivalent to ).įor using CPM.cmake projects with external package managers, such as conan or vcpkg, setting the variable CPM_USE_LOCAL_PACKAGES will make CPM.cmake try to add a package through find_package first, and add it from source if it doesn't succeed. ![]() _ADDED is set to YES if the dependency has not been added before, otherwise it is set to NO._BINARY_DIR is the path to the build directory of the dependency._SOURCE_DIR is the path to the source of the dependency.The version is explicitly givenĬPMAddPackage( calling CPMAddPackage, the following variables are defined in the local scope, where is the name of the dependency. # An archive package from a given url with an MD5 hash provided If an additional optional parameter SYSTEM is set to a truthy value, the SYSTEM directory property of the subdirectory added will be set to true.Ī single-argument compact syntax is also supported: If an additional optional parameter EXCLUDE_FROM_ALL is set to a truthy value, then any targets defined inside the dependency won't be built by default. GIT_TAG can also be set to a specific commit or a branch name such as master, however this isn't recommended, as such packages will only be updated when the cache is cleared. On the other hand, if VERSION hasn't been explicitly specified, CPM can automatically identify the version from the git tag in some common cases. If GIT_TAG hasn't been explicitly specified it defaults to v(VERSION), a common convention for git projects. The origin may be specified by a GIT_REPOSITORY, but other sources, such as direct URLs, are also supported. # Origin parameters forwarded to FetchContent_Declare, see below ![]() The asolute path of the active folder (e.g.NAME # The unique name of the dependency (should be the exported target's name) VERSION # The minimum version of the dependency (optional, defaults to 0) OPTIONS # Configuration options passed to the dependency (optional)ĭOWNLOAD_ONLY # If set, the project is downloaded, but not configured (optional) The CMake command used to build your project based on the currently selected Kit + Variant + Target. The full path to the directory where CMake cache files are located. Supports substitution for workspaceRoot, workspaceFolder, workspaceRootFolderName, userHome, $. Specify location of the cmake executable.Ĭmake (causes CMake Tools to search the PATH environment variable, as well as some hard-coded locations.) (empty array-no cache initializer files) Passed to CMake via the -C command-line argument. Path, or list of paths, to cache-initialization files. Null (no environment variables specified)Īn array of additional arguments to pass to the underlying build tool. the root directory where CMakeCache.txt will be generated.)Īn object containing key:value pairs of environment variables, which will be passed only to the compiler. If true, build the launch/debug target before running the target. If 'false', your active folder only changes if you manually run the CMake: Select Active Folder command.Īn array of additional arguments to pass to cmake -build. See variable substitution, below, for more information about variable expansion. Options that support substitution, in the table below, allow variable references to appear in their strings. This topic covers the available options and how they are used. CMake Tools supports a variety of settings that can be set at the user, or workspace, level via VSCode's settings.json file. ![]()
0 Comments
Leave a Reply. |