From dca03781610e5c3ff55a6f9fcc73178b4f4aae42 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Thu, 5 Dec 2024 19:44:07 +0100 Subject: [PATCH] Relax config search mode --- parse-files/mrpt-xxx-config.cmake.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/parse-files/mrpt-xxx-config.cmake.in b/parse-files/mrpt-xxx-config.cmake.in index 6073137820..7561a23082 100644 --- a/parse-files/mrpt-xxx-config.cmake.in +++ b/parse-files/mrpt-xxx-config.cmake.in @@ -34,18 +34,26 @@ if(NOT "${CMAKE_CURRENT_LIST_DIR}/../" IN_LIST CMAKE_PREFIX_PATH) endif() cmake_policy(POP) +# Prefer config instead of the old FindXXX() files +set(_BCK_CMAKE_FIND_PACKAGE_PREFER_CONFIG ${CMAKE_FIND_PACKAGE_PREFER_CONFIG}) +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) + # Search for dependencies first: set(_deps "@ALL_DEPS_LIST@") foreach(_dep ${_deps}) # NO quotes for the list to be a CMake list! if (${_dep}_FOUND) continue() # already found endif() - find_dependency(${_dep} CONFIG) # Don't look for old FindXXX() files + find_dependency(${_dep}) if(${_dep}_FOUND) mark_as_advanced(${_dep}_DIR) endif() endforeach() @EXTRA_CONFIG_CMDS@ +# Restore user's settings: +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${_BCK_CMAKE_FIND_PACKAGE_PREFER_CONFIG}) +unset(_BCK_CMAKE_FIND_PACKAGE_PREFER_CONFIG) + # Include targets for this library: include(${CMAKE_CURRENT_LIST_DIR}/mrpt-@MRPT_MODULE_NAME@-targets.cmake)