]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: verify minimum CMake version in `curl-config.cmake`
authorViktor Szakats <commit@vsz.me>
Sun, 30 Nov 2025 22:22:59 +0000 (23:22 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 1 Dec 2025 13:46:44 +0000 (14:46 +0100)
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

CMake/curl-config.cmake.in
CMakeLists.txt

index 7ae026d8f8c61e3e325f933dba18e807d93c5870..7f346c832ca5f7e98930571ceab49bcaeb3dec77 100644 (file)
 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@")
index 5bcf0b6a631a7f7ddf9a224a5dbf3edbd4dc036e..b45e7859e0902166726658f0daad57760224acfd 100644 (file)
@@ -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