From af6be725f5c1e7356878d3cc6a8fdb9c764e14c5 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Thu, 3 Jul 2025 16:14:36 -0700 Subject: [PATCH] CMake: Declare ASN1 dependency (#376) SwiftCrypto depends on SwiftASN1 which is declared in the exports file, but does not try to find the project, resulting in build failures of downstream projects that fail to explicitly call `find_package(SwiftASN1)` before `find_package(SwiftCrypto)`. Generally, it is recommended that project config files use `find_dependency` to search for the dependencies of the project they represent (https://cmake.org/cmake/help/v3.26/module/CMakeFindDependencyMacro.html). If the package is already found, either through `find_package` in the parent project, or through another means, the `find_dependency` call is a no-op. Co-authored-by: Cory Benfield --- cmake/modules/SwiftCryptoConfig.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/modules/SwiftCryptoConfig.cmake.in b/cmake/modules/SwiftCryptoConfig.cmake.in index 353de7b1..97e65bd6 100644 --- a/cmake/modules/SwiftCryptoConfig.cmake.in +++ b/cmake/modules/SwiftCryptoConfig.cmake.in @@ -13,5 +13,7 @@ ##===----------------------------------------------------------------------===## if(NOT TARGET SwiftCrypto) + include(CMakeFindDependencyMacro) + find_dependency(SwiftASN1) include(@SWIFT_CRYPTO_EXPORTS_FILE@) endif()