From: Viktor Szakats Date: Sun, 30 Nov 2025 22:22:59 +0000 (+0100) Subject: cmake: verify minimum CMake version in `curl-config.cmake` X-Git-Tag: rc-8_18_0-1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c421c3e3251b33e78b1c98030d92e6ad23a82d03;p=thirdparty%2Fcurl.git cmake: verify minimum CMake version in `curl-config.cmake` Show a message if the CMake version is lower than that when consuming libcurl via the CMake config. The minimum CMake version on consumption is for now the same as the minimum required (v3.7) to build curl itself. Ref: https://cmake.org/cmake/help/v3.7/variable/CMAKE_MINIMUM_REQUIRED_VERSION.html Ref: #18704 (discussion) Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973 Closes #19776 --- diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in index 7ae026d8f8..7f346c832c 100644 --- a/CMake/curl-config.cmake.in +++ b/CMake/curl-config.cmake.in @@ -26,6 +26,11 @@ option(CURL_USE_PKGCONFIG "Enable pkg-config to detect @PROJECT_NAME@ dependencies. Default: @CURL_USE_PKGCONFIG@" "@CURL_USE_PKGCONFIG@") +if(CMAKE_VERSION VERSION_LESS @CMAKE_MINIMUM_REQUIRED_VERSION@) + message(STATUS "@PROJECT_NAME@: @PROJECT_NAME@-specific Find modules require " + "CMake @CMAKE_MINIMUM_REQUIRED_VERSION@ or upper, found: ${CMAKE_VERSION}.") +endif() + include(CMakeFindDependencyMacro) if("@USE_OPENSSL@") diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bcf0b6a63..b45e7859e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2309,6 +2309,7 @@ if(NOT CURL_DISABLE_INSTALL) ${_generated_version_config}") # Consumed custom variables: + # CMAKE_MINIMUM_REQUIRED_VERSION # CURLVERSION # LIBCURL_PC_LIBS_PRIVATE_LIST # LIB_NAME