From ec9dae9a6fb0670cf83ae5713c8644a81e9e0b77 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 28 Feb 2024 20:25:41 -0800 Subject: fixes #1771 cmake: respect CMAKE_FIND_PACKAGE_PREFER_CONFIG if present --- src/supplemental/tls/mbedtls/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/supplemental/tls/mbedtls/CMakeLists.txt b/src/supplemental/tls/mbedtls/CMakeLists.txt index e3d767fc..7e24e299 100644 --- a/src/supplemental/tls/mbedtls/CMakeLists.txt +++ b/src/supplemental/tls/mbedtls/CMakeLists.txt @@ -25,12 +25,12 @@ if (NNG_TLS_ENGINE STREQUAL "mbed") else() # We want to prefer config mode over our local find package. # mbedTLS v3 has a config file, which should work better than - # what we do here. We do restore the setting though because - # user applications might not expect this. - if (NOT CMAKE_FIND_PACKAGE_PREFER_CONFIG) + # what we do here. We only make this override locally, to + # avoid confounding any other package consumers, and we honor overrides. + if (NOT (DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) find_package(MbedTLS REQUIRED) - set(CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE) + unset(CMAKE_FIND_PACKAGE_PREFER_CONFIG) else() find_package(MbedTLS REQUIRED) endif() -- cgit v1.2.3-70-g09d2