Skip to content

Commit

Permalink
[Config] Fix Findmetis module when using config mode (#4570)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
olivier-roussel authored and bakpaul committed Mar 11, 2024
1 parent ce05d76 commit 513a06c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sofa/framework/Config/cmake/Modules/Findmetis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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()

Expand Down

0 comments on commit 513a06c

Please sign in to comment.