This happens because the CMake script starts using CURL_CA_BUNDLE_SET as a temporary variable to drive logic.
But then once it's done it sets CURL_CA_BUNDLE_SET both as a user-configurable variable to drive logic, and a way to inform the user that the CA Bundle has been set.
So when the script is ran a 2nd time, it sees CURL_CA_BUNDLE_SET is set 'manually' (the code seems to assume it's been set by the user) and thus early outs from autodetecting the paths.
Solutions
I believe this is what's intended:
set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
set(CURL_CA_PATH "/etc/ssl/certs" CACHE STRING
"Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
It fixes the problem because now the script also remembers the path that were searched during the 1st run.
This is the patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ffb72faf..7ea5867b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -851,7 +851,8 @@ elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT)
foreach(SEARCH_CA_BUNDLE_PATH ${SEARCH_CA_BUNDLE_PATHS})
if(EXISTS "${SEARCH_CA_BUNDLE_PATH}")
message(STATUS "Found CA bundle: ${SEARCH_CA_BUNDLE_PATH}")
- set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}")
+ set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}" CACHE STRING
+ "Path to the CA bundle. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
set(CURL_CA_BUNDLE_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
break()
endif()
@@ -860,7 +861,8 @@ elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT)
if(CURL_CA_PATH_AUTODETECT AND (NOT CURL_CA_PATH_SET))
if(EXISTS "/etc/ssl/certs")
- set(CURL_CA_PATH "/etc/ssl/certs")
+ set(CURL_CA_PATH "/etc/ssl/certs" CACHE STRING
+ "Location of default CA path. Set 'none' to disable or 'auto' for auto-detection. Defaults to 'auto'.")
set(CURL_CA_PATH_SET TRUE CACHE BOOL "Path to the CA bundle has been set")
endif()
endif()
I can submit a PR if you want me to; but I'm not 100% if this is the intended solution.
I did this
It is quite common practice to run CMake configure more than once.
In fact super ultra common for IDEs like QtCreator.
The first run results in this file:
curl_config.first.run.h.zip
The second run results in this file:
curl_config.next.runs.h.zip
To be more concrete, the only 2 differences (at least on Ubuntu 18.04 LTS) are these:
vs
I expected the following
The first file should always be created
Why this happens?
This happens because the CMake script starts using CURL_CA_BUNDLE_SET as a temporary variable to drive logic.
But then once it's done it sets CURL_CA_BUNDLE_SET both as a user-configurable variable to drive logic, and a way to inform the user that the CA Bundle has been set.
So when the script is ran a 2nd time, it sees CURL_CA_BUNDLE_SET is set 'manually' (the code seems to assume it's been set by the user) and thus early outs from autodetecting the paths.
Solutions
I believe this is what's intended:
It fixes the problem because now the script also remembers the path that were searched during the 1st run.
This is the patch:
I can submit a PR if you want me to; but I'm not 100% if this is the intended solution.
Update: PR 7101 submitted
curl/libcurl version
curl-7.76.1.tar.bz2
Bug is present as of latest d845d39
operating system
Xubuntu 18.04 LTS
CMake version 3.20.2 (via snap)
Linux matias-ubuntu 5.11.0-051100-generic #202102142330 SMP Sun Feb 14 23:33:21 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: