summaryrefslogtreecommitdiff
path: root/Modules/FetchContent.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'add_subdirectory_system'Brad King2022-09-271-2/+17
|\ | | | | | | | | | | | | 2eb30a7036 add_subdirectory: Add SYSTEM option Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7399
| * add_subdirectory: Add SYSTEM optionDa Quexian2022-09-261-2/+17
| | | | | | | | | | Fixes: #22401 Signed-off-by: Da Quexian <daquexian566@gmail.com>
* | Merge topic 'fetchcontent-redirect-version-exact'Brad King2022-09-121-3/+6
|\ \ | | | | | | | | | | | | | | | | | | 48b380c961 FetchContent: Ignore EXACT for redirected find_package() calls Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7665
| * | FetchContent: Ignore EXACT for redirected find_package() callsCraig Scott2022-09-111-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When FetchContent_MakeAvailable() populates a dependency for which find_package() integration is enabled, all future calls to find_package() MUST succeed using the contents of the redirection directory. The generated config version file was not handling calls where the EXACT keyword was given, resulting in such calls rejecting the redirection directory's contents and continuing its search. It is not allowed to do that. Fix the generated file to also set PACKAGE_VERSION_EXACT to true so that calls with EXACT now accept it, as was originally intended. Fixes: #23950
* | | Merge topic 'fetchcontent-unset-wrong-nested-var'Craig Scott2022-09-111-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | d9a6e0ffc8 FetchContent: Fix unsetting wrong variable name after provider returns Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7663
| * | | FetchContent: Fix unsetting wrong variable name after provider returnsCraig Scott2022-09-101-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unset() command was using __cmake_contentNameLower before that variable was restored from the __cmake_fcCurrentVarsStack. That means if there had been a nested call to FetchContent_MakeAvailable(), the wrong variable name would have been cleared (the nested name instead of the one from the current call). That would have left the variable set upon return, blocking the dependency provider from seeing any further calls to FetchContent_MakeAvailable() in the current variable scope or below for the current dependency.
* | | Merge topic 'fetchcontent-extra'Brad King2022-09-091-4/+4
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | 629d106c5e Help: Fix typo in FetchContent example, extras should read extra Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: hinell <al.neodim@gmail.com> Merge-request: !7657
| * | Help: Fix typo in FetchContent example, extras should read extraMathieu Malaterre2022-09-091-4/+4
| | | | | | | | | | | | | | | Amends 29e31e2825a (Packages: Integrate FetchContent and find_package(), 2022-04-28)
* | | Merge topic 'doc-fetchcontent-gtest-example'Craig Scott2022-09-051-2/+2
|\ \ \ | |/ / | | | | | | | | | | | | | | | daa2a6cda6 Help: Fix wrong casing of GTest in FetchContent integration example Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7644
| * | Help: Fix wrong casing of GTest in FetchContent integration exampleCraig Scott2022-09-041-2/+2
| | |
* | | FetchContent: Fix protobuf example to avoid CMP0077 warningHarald Fernengel2022-08-131-3/+4
|/ / | | | | | | | | | | The protobuf example would raise a "Policy CMP0077" warning and protobuf tests would still be built, e.g. setting the variable is ignored in latest CMake. Set an INTERNAL cache variable instead so that CMP0077 warnings won't be triggered.
* | FetchContent: Disable header set verification for dependenciesCraig Scott2022-08-041-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CMAKE_VERIFY_INTERFACE_HEADER_SETS variable is intended to be under the control of the user. It doesn't discriminate between header sets defined in the main project and those defined by dependencies brought into the build directly via FetchContent. Developers will usually only be interested in verifying the main project's header sets, not those from dependencies. Make the variable effectively only enable header set verification of the main project by turning it off during FetchContent_MakeAvailable() calls. The user still has variables like CMAKE_PROJECT_INCLUDE and CMAKE_PROJECT_<projectName>_INCLUDE available to them if they want to enable verification of all or specific dependencies respectively. Fixes: #23808
* | FetchContent: Restore support for multiple URL valuesCraig Scott2022-07-291-29/+42
| | | | | | | | | | | | | | | | | | In c2044fdf3f (FetchContent: Respect the CMP0135 policy setting, 2022-06-02), the URL keyword was wrongly assumed to only have a single value. Multiple URL values are allowed if they are all non-local. Rework the logic to remove that incorrect assumption and handle both single and multi-value URL combinations. Fixes: #23792
* | FetchContent: Don't use if(... IN_LIST ...)Craig Scott2022-06-291-2/+8
|/ | | | This avoids the need for changing policy settings, which would then propagate through to projects brought into the build via FetchContent.
* FetchContent: Fix example code in documentationpigeon2022-06-211-3/+3
|
* Merge topic 'fetchcontent-global-targets' into release-3.24Brad King2022-06-111-2/+24
|\ | | | | | | | | | | | | | | | | f19b48e0b8 FetchContent: Honor CMAKE_FIND_PACKAGE_TARGETS_GLOBAL 1305bade56 Help: Add missing version directive for find_package() GLOBAL keyword Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7347
| * FetchContent: Honor CMAKE_FIND_PACKAGE_TARGETS_GLOBALCraig Scott2022-06-101-2/+24
| | | | | | Fixes: #23606
* | Help: Overhaul and expand the Using Dependencies GuideCraig Scott2022-06-091-1/+7
|/ | | | | | | | The guide previously only focused on the find_package() command, with a bias towards libraries. FetchContent was not mentioned at all. Reorganise and update the existing content. Add new sections to cover providing dependencies with FetchContent and dependency providers. Improve discoverability of the guide by mentioning it at the beginning of the find_package(), FetchContent and dependency provider docs.
* FetchContent: Respect the CMP0135 policy settingCraig Scott2022-06-021-6/+43
| | | Fixes: #23560
* Merge topic 'dependency-providers'Brad King2022-05-251-42/+197
|\ | | | | | | | | | | | | | | | | | | | | 2aa83fa15b Dependency providers: Add find_package and FetchContent support 8a28368feb FetchContent: Don't discard non-empty SOURCE_DIR and BINARY_DIR 8ce9bb8a0c FetchContent: Don't leak internal variables 74a6ddc339 cmFindPackageCommand: Handle Makefile variable definitions more robustly Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Gerhard Olsson <gerhard.nospam@gmail.com> Merge-request: !7276
| * Dependency providers: Add find_package and FetchContent supportCraig Scott2022-05-251-36/+177
| | | | | | Fixes: #22619
| * FetchContent: Don't discard non-empty SOURCE_DIR and BINARY_DIRCraig Scott2022-05-181-3/+9
| |
| * FetchContent: Don't leak internal variablesCraig Scott2022-05-181-3/+11
| |
* | FetchContent: Use Debug rather than Release for sub-buildCraig Scott2022-05-171-3/+3
|/ | | | | | | | The config used can be part of the path to the sub-build. On some platforms, there are restrictions on the length of paths or file names. Use Debug rather than Release because the former is shorter. When CMAKE_CONFIGURATION_TYPES is left at its default, this also makes the path the same as the previous default before 10865c8e5f (FetchContent: Hard-code a config for the sub-build, 2022-05-01) .
* Merge topic 'fetchcontent-subbuild-config-type'Craig Scott2022-05-161-2/+11
|\ | | | | | | | | | | | | | | 10865c8e5f FetchContent: Hard-code a config for the sub-build Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7228
| * FetchContent: Hard-code a config for the sub-buildCraig Scott2022-05-131-2/+11
| | | | | | | | | | | | | | | | | | If the main project overrides CMAKE_CONFIGURATION_TYPES such that there is no Debug configuration, some multi-config generators can fail because they might assume Debug by default (Visual Studio might do this). Always specify the configuration for multi-config generators so that we don't rely on any such defaults. Fixes: #23177
* | Packages: Integrate FetchContent and find_package()Craig Scott2022-05-031-44/+475
|/ | | | | | | | Allow FetchContent_MakeAvailable() to try a call to find_package() first, or redirect a find_package() call to FetchContent_MakeAvailable(). The user can set variables to control which of these are allowed or tried by default. Fixes: #21687
* ExternalProject: Add support for USES_TERMINAL_PATCH keywordCraig Scott2022-02-031-1/+2
| | | | | | | This brings the patch step into line with all the others which already had their own `USES_TERMINAL_<step>` keyword. All steps (including patch) already have their own `LOG_<step>` keyword too, so the lack of `USES_TERMINAL_PATCH` was inconsistent.
* FetchContent: Fix typo in documentationJukka Aho2021-12-151-1/+1
|
* FetchContent: Pass through networking-related CMAKE_... variablesCraig Scott2021-10-051-7/+25
| | | | | | | CMAKE_TLS_VERIFY, CMAKE_TLS_CAINFO, CMAKE_NETRC and CMAKE_NETRC_FILE are now passed through to the underlying ExternalProject sub-build. Previously, they were silently ignored. Fixes: #22144
* Help: Rework docs to prioritize FetchContent_MakeAvailable()Craig Scott2021-08-231-200/+252
| | | | | | | | | | | | FetchContent_MakeAvailable() should be strongly preferred over the direct use of FetchContent_Populate(). The latter was the only method available before CMake 3.14, but the former is simpler and offers more functionality. Restructure the docs and improve the wording to steer the reader toward `FetchContent_MakeAvailable()` as the preferred approach. Also take the opportunity to pull out the variables that influence behavior into their own section. They were easily missed when buried in the docs for the FetchContent_Populate() command.
* FetchContent: Use private local variables in FetchContent_MakeAvailableArcturus Arcturus2021-05-131-15/+21
|
* Modules: Fix typos and spelling in documentationJosef Angstenberger2021-05-071-1/+1
|
* Modules: Fix typos and spelling in commentsJosef Angstenberger2021-05-071-1/+1
|
* Merge topic 'ep-fc-revert-refactoring'Brad King2021-03-101-17/+114
|\ | | | | | | | | | | | | 57d442e182 Revert ExternalProject and FetchContent refactoring Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5898
| * Revert ExternalProject and FetchContent refactoringCraig Scott2021-03-101-17/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring of the ExternalProject and FetchContent modules moved the commands into CMake scripts. This broke custom commands that used shell redirection or special build tool variables of the form $(MakeVar). Undo the sequence of commits that performed this refactoring and follow-up fixes associated with it. The following commits are reverted by this change: 4f3d1abbb4 (ExternalProject: Refactor pre-configure steps to support no-target uses, 2021-02-05) 17e5516e60 (FetchContent: Invoke steps directly and avoid a separate sub-build, 2021-01-29) bd876f3849 (FetchContent: Restore patch command support, 2021-02-18) 404cddb7bb (ExternalProject: Fix misuse of IS_NEWER_THAN in timestamp checks, 2021-02-21) b0da671243 (FetchContent: Don't update timestamps if files don't change, 2021-02-18) Fixes: #21892
* | Help: Prefer commit hashes in FetchContent examples for security reasonsHarmen Stoppels2021-02-251-6/+11
| | | | | | | | Fixes: #21841 Co-Authored-By: Craig Scott <craig.scott@crascit.com>
* | Help: Add missing MD5= for URL_HASH in FetchContent exampleCraig Scott2021-02-251-1/+1
|/ | | Fixes: #21859
* FetchContent: Invoke steps directly and avoid a separate sub-buildCraig Scott2021-02-051-114/+17
| | | | | | | | | | | | The cost of setting up and executing a separate sub-build to do the download, update and patch steps required for FetchContent population can be significant with some platforms and CMake generators. Avoid the sub-build altogether by invoking the step scripts directly. Previously, if no generator was set (e.g. population was being done in script mode), a generator needed to be available on the default PATH. Since we no longer use a sub-build, this restriction is also now gone. Fixes: #21703
* FindGit: Cache the GIT_EXECUTABLE version for the current runCraig Scott2021-01-201-0/+16
| | | | | | | | | | | The git version should not change while CMake is running. When using FetchContent with many dependencies, the repeated calls to get the git version every time ExternalProject is used can be measurable on some platforms. This commit queries that version only once and then caches it in a global property for the rest of that run. The git version can still safely change between runs because it is not cached, only the GIT_EXECUTABLE location is cached. Relates: #21703
* Merge topic 'fc-relative-SOURCE_DIR'Craig Scott2020-12-221-1/+8
|\ | | | | | | | | | | | | 51595e5f01 FetchContent: Relative SOURCE_DIR override cannot be a hard error Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5641
| * FetchContent: Relative SOURCE_DIR override cannot be a hard errorCraig Scott2020-12-221-1/+8
| | | | | | Fixes: #21624
* | Help: Add `.. versionadded` directives to module docsNikita Nemkin2020-12-021-0/+7
|/ | | | Issue: #19715
* FetchContent: Raise error if manually given source dir does not existCraig Scott2020-10-031-0/+6
| | | Fixes: #21208
* FetchContent: Fix SOURCE_DIR, BUILD_DIR when disconnected or overriddenCraig Scott2020-08-231-10/+31
| | | Fixes: #21123
* Help: Add Sphinx 'versionadded' directives to each top-level documentKitware Robot2020-07-061-0/+2
| | | | | | | Run the `Utilities/Sphinx/update_versions.py` script to add initial markup to every top-level document and find module. Issue: #19715
* FetchContent: Pass through CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY if setCraig Scott2020-05-291-6/+11
| | | | | This was missed when the initial support was added in commit 0aea435aa1 (ExternalProject: Provide choice of git update strategies, 2020-02-12)
* FetchContent: Preserve empty string argumentsCraig Scott2020-05-231-21/+41
| | | | Fixes: #20579
* FetchContent: Add support for SOURCE_SUBDIRCraig Scott2020-05-161-12/+58
| | | Fixes: #19875
* FetchContent: Add support for DOWNLOAD_NO_EXTRACTCraig Scott2020-04-031-0/+22
| | | Fixes: #20526