cmake: save and restore `CMAKE_MODULE_PATH` in `curl-config.cmake`
Reported-by: Kai Pastor
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 16f073ef49f94412000218c9f6ad04e3fd7e4d01 #16973
Closes #19758
diff --git a/CMake/curl-config.cmake.in b/CMake/curl-config.cmake.in
index 9994919..c4e9f59 100644
--- a/CMake/curl-config.cmake.in
+++ b/CMake/curl-config.cmake.in
@@ -26,6 +26,8 @@
option(CURL_USE_PKGCONFIG "Enable pkg-config to detect @PROJECT_NAME@ dependencies. Default: @CURL_USE_PKGCONFIG@" "@CURL_USE_PKGCONFIG@")
include(CMakeFindDependencyMacro)
+
+set(_curl_cmake_module_path_save ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})
set(_libs "")
@@ -126,6 +128,8 @@
list(APPEND _libs CURL::zstd)
endif()
+set(CMAKE_MODULE_PATH ${_curl_cmake_module_path_save})
+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND WIN32 AND NOT TARGET CURL::win32_winsock)
add_library(CURL::win32_winsock INTERFACE IMPORTED)
set_target_properties(CURL::win32_winsock PROPERTIES INTERFACE_LINK_LIBRARIES "@_win32_winsock@")