summaryrefslogtreecommitdiff
path: root/Utilities/cmlibarchive
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-17 07:54:39 -0500
committerBrad King <brad.king@kitware.com>2022-02-17 08:06:01 -0500
commit483a1c248c7d46edf76070d9861ebdfc27b7a7a4 (patch)
treec8c225275ee062bcf351ad394ecdee2586c54444 /Utilities/cmlibarchive
parentbd575a291835af01fce4f492b763d32a5f646276 (diff)
downloadcmake-483a1c248c7d46edf76070d9861ebdfc27b7a7a4.tar.gz
libarchive: Fix OpenSSL crypto library checks for build inside CMake
libarchive's crypto library checks use its `config.h` inside the `try_compile` project. Since commit ade3b16e63 (libarchive: Use KWIML to get fixed-size integer types, 2020-06-01, v3.18.0-rc1~33^2), that header depends on KWIML inside CMake. Add the include directory for KWIML to the crypto library checks. Otherwise, they always fail due to not finding the KWIML headers, and libarchive decides not to link the crypto library. libarchive has other code besides the hash algorithms that depends on the crypto library if its ENABLE_OPENSSL option is enabled (which in CMake is controlled by CMAKE_USE_OPENSSL). It seems to be missing some conditions to link the crypto library in those cases, and instead relies on at least one of the above-mentioned checks to pass. If they all fail, and we are using system curl, we might not link the crypto library. Fixes: #23234
Diffstat (limited to 'Utilities/cmlibarchive')
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index c2aa182635..2a788ff1be 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -863,6 +863,8 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION)
# crypto implementation is available on this platform.
SET(TRY_CRYPTO_REQUIRED_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
+ LIST(APPEND TRY_CRYPTO_REQUIRED_INCLUDES "${CMake_SOURCE_DIR}/Utilities" "${CMake_BINARY_DIR}/Utilities") # for KWIML inside CMake
+
SET(TRY_CRYPTO_REQUIRED_LIBS)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
SET(TRY_CRYPTO_REQUIRED_INCLUDES