From 513a06cb05035017a65d1dec02e8b183d7cbd2a7 Mon Sep 17 00:00:00 2001 From: Olivier Roussel Date: Fri, 8 Mar 2024 10:37:05 +0100 Subject: [PATCH] [Config] Fix Findmetis module when using config mode (#4570) * handle cmake config files starting with uppercase for case sensitive OS * fix case where config cmake file is used and version defined by config files * do not fail on error if wrong version is installed and allow fetching --- Sofa/framework/Config/cmake/Modules/Findmetis.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sofa/framework/Config/cmake/Modules/Findmetis.cmake b/Sofa/framework/Config/cmake/Modules/Findmetis.cmake index 6a29daaa69f..6bc48aead4a 100644 --- a/Sofa/framework/Config/cmake/Modules/Findmetis.cmake +++ b/Sofa/framework/Config/cmake/Modules/Findmetis.cmake @@ -14,7 +14,7 @@ # was used to provide the library, as some package managers (such vcpkg) defines only short name # for the target, whereas others (such as conan) defines a fully qualified name. -find_package(metis NO_MODULE QUIET HINTS ${metis_DIR}) +find_package(metis NO_MODULE QUIET HINTS ${metis_DIR} NAMES metis Metis) if(NOT metis_FIND_VERSION) @@ -46,12 +46,12 @@ macro(_metis_check_version) set(metis_VERSION_OK TRUE) if(${metis_VERSION} VERSION_LESS ${metis_FIND_VERSION}) set(metis_VERSION_OK FALSE) - message(SEND_ERROR "metis version ${metis_VERSION} found in ${metis_INCLUDE_DIR}, " + message(WARNING "metis version ${metis_VERSION} found in ${metis_INCLUDE_DIR}, " "but at least version ${metis_FIND_VERSION} is required") endif() if(${metis_FIND_VERSION_EXACT} AND NOT ${metis_VERSION} VERSION_EQUAL ${metis_FIND_VERSION}) set(metis_VERSION_OK FALSE) - message(SEND_ERROR "metis version ${metis_VERSION} found in ${metis_INCLUDE_DIR}, " + message(WARNING "metis version ${metis_VERSION} found in ${metis_INCLUDE_DIR}, " "but exact version ${metis_FIND_VERSION} is required") endif() endmacro() @@ -60,8 +60,8 @@ if(TARGET metis) set(metis_FOUND TRUE) # only metis_FOUND has been set if(metis_INCLUDE_DIR AND NOT DEFINED metis_VERSION) _metis_check_version() + set(metis_FOUND ${metis_VERSION_OK}) endif() - set(metis_FOUND ${metis_VERSION_OK}) add_library(metis::metis ALIAS metis) else()