summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-10-06 11:07:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-10-06 11:07:32 (GMT)
commit9a88f5df3e41a9caef46a5fcea178d7ea9a377bb (patch)
treea80d8b9fed533109406652537384bdd4c055e1a6 /Modules
parent380f9020eb2935861dbfd3a5549c7289eadfb33b (diff)
parent1851aa49be01076e0869ce14b22b9a860454bba4 (diff)
downloadCMake-9a88f5df3e41a9caef46a5fcea178d7ea9a377bb.zip
CMake-9a88f5df3e41a9caef46a5fcea178d7ea9a377bb.tar.gz
CMake-9a88f5df3e41a9caef46a5fcea178d7ea9a377bb.tar.bz2
Merge topic 'fetchcontent-CMAKE-vars-passthrough'
1851aa49be FetchContent: Pass through networking-related CMAKE_... variables 96937438b7 Help: Clean up how TLS and NETRC variables are discussed 2a82bd85b6 Help: Add documentation for CMAKE_TLS_CAINFO Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6589
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ExternalProject.cmake8
-rw-r--r--Modules/FetchContent.cmake32
2 files changed, 29 insertions, 11 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 9e25bee..e49faae 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -224,14 +224,14 @@ External Project Definition
``TLS_CAINFO <file>``
Specify a custom certificate authority file to use if ``TLS_VERIFY``
is enabled. If this option is not specified, the value of the
- ``CMAKE_TLS_CAINFO`` variable will be used instead (see
+ :variable:`CMAKE_TLS_CAINFO` variable will be used instead (see
:command:`file(DOWNLOAD)`)
``NETRC <level>``
.. versionadded:: 3.11
Specify whether the ``.netrc`` file is to be used for operation.
- If this option is not specified, the value of the ``CMAKE_NETRC``
+ If this option is not specified, the value of the :variable:`CMAKE_NETRC`
variable will be used instead (see :command:`file(DOWNLOAD)`)
Valid levels are:
@@ -251,8 +251,8 @@ External Project Definition
Specify an alternative ``.netrc`` file to the one in your home directory
if the ``NETRC`` level is ``OPTIONAL`` or ``REQUIRED``. If this option
- is not specified, the value of the ``CMAKE_NETRC_FILE`` variable will
- be used instead (see :command:`file(DOWNLOAD)`)
+ is not specified, the value of the :variable:`CMAKE_NETRC_FILE` variable
+ will be used instead (see :command:`file(DOWNLOAD)`)
.. versionadded:: 3.1
Added support for `tbz2`, `.tar.xz`, `.txz`, and `.7z` extensions.
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 5ea8b2a..be75689 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -162,6 +162,13 @@ Commands
This may be needed for things like password prompts or real-time display
of command progress.
+ .. versionadded:: 3.22
+ The :variable:`CMAKE_TLS_VERIFY`, :variable:`CMAKE_TLS_CAINFO`,
+ :variable:`CMAKE_NETRC` and :variable:`CMAKE_NETRC_FILE` variables now
+ provide the defaults for their corresponding content options, just like
+ they do for :command:`ExternalProject_Add`. Previously, these variables
+ were ignored by the ``FetchContent`` module.
+
.. command:: FetchContent_MakeAvailable
.. versionadded:: 3.14
@@ -1016,18 +1023,29 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
unset(subCMakeOpts)
endif()
- if(DEFINED CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY)
- list(APPEND subCMakeOpts
- "-DCMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY=${CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY}")
- endif()
+ set(__FETCHCONTENT_CACHED_INFO "")
+ set(__passthrough_vars
+ CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY
+ CMAKE_TLS_VERIFY
+ CMAKE_TLS_CAINFO
+ CMAKE_NETRC
+ CMAKE_NETRC_FILE
+ )
+ foreach(var IN LISTS __passthrough_vars)
+ if(DEFINED ${var})
+ # Embed directly in the generated CMakeLists.txt file to avoid making
+ # the cmake command line excessively long. It also makes debugging and
+ # testing easier.
+ string(APPEND __FETCHCONTENT_CACHED_INFO "set(${var} [==[${${var}}]==])\n")
+ endif()
+ endforeach()
# Avoid using if(... IN_LIST ...) so we don't have to alter policy settings
- set(__FETCHCONTENT_CACHED_INFO "")
list(FIND ARG_UNPARSED_ARGUMENTS GIT_REPOSITORY indexResult)
if(indexResult GREATER_EQUAL 0)
find_package(Git QUIET)
- set(__FETCHCONTENT_CACHED_INFO
-"# Pass through things we've already detected in the main project to avoid
+ string(APPEND __FETCHCONTENT_CACHED_INFO "
+# Pass through things we've already detected in the main project to avoid
# paying the cost of redetecting them again in ExternalProject_Add()
set(GIT_EXECUTABLE [==[${GIT_EXECUTABLE}]==])
set(GIT_VERSION_STRING [==[${GIT_VERSION_STRING}]==])