ExternalProject: Honor CMAKE_TLS_VERIFY environment variable
Issue: #23608
This commit is contained in:
parent
e8404502b1
commit
0d250dd021
@ -9,3 +9,7 @@ Specify the default value for the :command:`file(DOWNLOAD)` and
|
|||||||
:command:`file(UPLOAD)` commands' ``TLS_VERIFY`` option.
|
:command:`file(UPLOAD)` commands' ``TLS_VERIFY`` option.
|
||||||
This environment variable is used if the option is not given
|
This environment variable is used if the option is not given
|
||||||
and the :variable:`CMAKE_TLS_VERIFY` cmake variable is not set.
|
and the :variable:`CMAKE_TLS_VERIFY` cmake variable is not set.
|
||||||
|
|
||||||
|
This variable is also used by the :module:`ExternalProject` and
|
||||||
|
:module:`FetchContent` modules for internal calls to
|
||||||
|
:command:`file(DOWNLOAD)` and ``git clone``.
|
||||||
|
@ -243,22 +243,28 @@ URL
|
|||||||
``TLS_VERIFY <bool>``
|
``TLS_VERIFY <bool>``
|
||||||
Specifies whether certificate verification should be performed for
|
Specifies whether certificate verification should be performed for
|
||||||
``https://`` URLs. If this option is not provided, the value of the
|
``https://`` URLs. If this option is not provided, the value of the
|
||||||
:variable:`CMAKE_TLS_VERIFY` variable will be used instead (see
|
:variable:`CMAKE_TLS_VERIFY` variable or the :envvar:`CMAKE_TLS_VERIFY`
|
||||||
:command:`file(DOWNLOAD)`).
|
environment variable will be used instead (see :command:`file(DOWNLOAD)`).
|
||||||
If that is also not set, certificate verification will not be performed.
|
If neither of those is set, certificate verification will not be performed.
|
||||||
In situations where ``URL_HASH`` cannot be provided, this option can
|
In situations where ``URL_HASH`` cannot be provided, this option can
|
||||||
be an alternative verification measure.
|
be an alternative verification measure.
|
||||||
|
|
||||||
This option also applies to ``git clone`` invocations, although the
|
This option also applies to ``git clone`` invocations, although the
|
||||||
default behavior is different. If neither the ``TLS_VERIFY`` option
|
default behavior is different. If none of the ``TLS_VERIFY`` option,
|
||||||
or :variable:`CMAKE_TLS_VERIFY` variable is specified, the behavior
|
:variable:`CMAKE_TLS_VERIFY` variable, or :envvar:`CMAKE_TLS_VERIFY`
|
||||||
will be determined by git's default (true) or a ``http.sslVerify``
|
environment variable is specified, the behavior will be determined by
|
||||||
git config option the user may have set at a global level.
|
git's default (true) or a ``http.sslVerify`` git config option the
|
||||||
|
user may have set at a global level.
|
||||||
|
|
||||||
.. versionchanged:: 3.6
|
.. versionchanged:: 3.6
|
||||||
|
|
||||||
Previously this option did not apply to ``git clone`` invocations.
|
Previously this option did not apply to ``git clone`` invocations.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.30
|
||||||
|
|
||||||
|
Previously the :envvar:`CMAKE_TLS_VERIFY` environment variable
|
||||||
|
was not checked.
|
||||||
|
|
||||||
``TLS_CAINFO <file>``
|
``TLS_CAINFO <file>``
|
||||||
Specify a custom certificate authority file to use if ``TLS_VERIFY``
|
Specify a custom certificate authority file to use if ``TLS_VERIFY``
|
||||||
is enabled. If this option is not specified, the value of the
|
is enabled. If this option is not specified, the value of the
|
||||||
@ -1397,8 +1403,12 @@ endfunction()
|
|||||||
|
|
||||||
function(_ep_get_tls_verify name tls_verify_var)
|
function(_ep_get_tls_verify name tls_verify_var)
|
||||||
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
|
get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
|
||||||
if("x${tls_verify}" STREQUAL "x" AND DEFINED CMAKE_TLS_VERIFY)
|
if("x${tls_verify}" STREQUAL "x")
|
||||||
set(tls_verify "${CMAKE_TLS_VERIFY}")
|
if(NOT "x${CMAKE_TLS_VERIFY}" STREQUAL "x")
|
||||||
|
set(tls_verify "${CMAKE_TLS_VERIFY}")
|
||||||
|
elseif(NOT "x$ENV{CMAKE_TLS_VERIFY}" STREQUAL "x")
|
||||||
|
set(tls_verify "$ENV{CMAKE_TLS_VERIFY}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set("${tls_verify_var}" "${tls_verify}" PARENT_SCOPE)
|
set("${tls_verify_var}" "${tls_verify}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
Loading…
Reference in New Issue
Block a user