mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix cmake warnings, FindPASTIX/FindPTSCOTCH.
We were getting a lot of warnings due to nested `find_package` calls within `Find***.cmake` files. The recommended approach is to use [`find_dependency`](https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html) in package configuration files. I made this change for all instances. Case mismatches between `Find<Package>.cmake` and calling `find_package(<PACKAGE>`) also lead to warnings. Fixed for `FindPASTIX.cmake` and `FindSCOTCH.cmake`. `FindBLASEXT.cmake` was broken due to calling `find_package_handle_standard_args(BLAS ...)`. The package name must match, otherwise the `find_package(BLASEXT)` falsely thinks the package wasn't found. I changed to `BLASEXT`, but then also copied that value to `BLAS_FOUND` for compatibility. `FindPastix.cmake` had a typo that incorrectly added `PTSCOTCH` when looking for the `SCOTCH` component. `FindPTSCOTCH` incorrectly added `***-NOTFOUND` to include/library lists, corrupting them. This led to cmake errors down-the-line. Fixes #2288.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
8cf6cb27ba
commit
1cdec38653
@@ -79,20 +79,21 @@ if( PTSCOTCH_FIND_COMPONENTS )
|
||||
endif()
|
||||
|
||||
# PTSCOTCH depends on Threads, try to find it
|
||||
include(CMakeFindDependencyMacro)
|
||||
if (NOT THREADS_FOUND)
|
||||
if (PTSCOTCH_FIND_REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_dependency(Threads REQUIRED)
|
||||
else()
|
||||
find_package(Threads)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# PTSCOTCH depends on MPI, try to find it
|
||||
if (NOT MPI_FOUND)
|
||||
if (PTSCOTCH_FIND_REQUIRED)
|
||||
find_package(MPI REQUIRED)
|
||||
find_dependency(MPI REQUIRED)
|
||||
else()
|
||||
find_package(MPI)
|
||||
find_dependency(MPI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -148,18 +149,18 @@ else()
|
||||
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
|
||||
set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")
|
||||
find_path(PTSCOTCH_${ptscotch_hdr}_DIRS
|
||||
NAMES ${ptscotch_hdr}
|
||||
HINTS ${PTSCOTCH_DIR}
|
||||
PATH_SUFFIXES "include" "include/scotch")
|
||||
NAMES ${ptscotch_hdr}
|
||||
HINTS ${PTSCOTCH_DIR}
|
||||
PATH_SUFFIXES "include" "include/scotch")
|
||||
mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)
|
||||
endforeach()
|
||||
else()
|
||||
foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
|
||||
set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")
|
||||
find_path(PTSCOTCH_${ptscotch_hdr}_DIRS
|
||||
NAMES ${ptscotch_hdr}
|
||||
HINTS ${_inc_env}
|
||||
PATH_SUFFIXES "scotch")
|
||||
NAMES ${ptscotch_hdr}
|
||||
HINTS ${_inc_env}
|
||||
PATH_SUFFIXES "scotch")
|
||||
mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)
|
||||
endforeach()
|
||||
endif()
|
||||
@@ -171,7 +172,6 @@ foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})
|
||||
if (PTSCOTCH_${ptscotch_hdr}_DIRS)
|
||||
list(APPEND PTSCOTCH_INCLUDE_DIRS "${PTSCOTCH_${ptscotch_hdr}_DIRS}")
|
||||
else ()
|
||||
set(PTSCOTCH_INCLUDE_DIRS "PTSCOTCH_INCLUDE_DIRS-NOTFOUND")
|
||||
if (NOT PTSCOTCH_FIND_QUIETLY)
|
||||
message(STATUS "Looking for ptscotch -- ${ptscotch_hdr} not found")
|
||||
endif()
|
||||
@@ -229,16 +229,16 @@ else()
|
||||
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
|
||||
set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")
|
||||
find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY
|
||||
NAMES ${ptscotch_lib}
|
||||
HINTS ${PTSCOTCH_DIR}
|
||||
PATH_SUFFIXES lib lib32 lib64)
|
||||
NAMES ${ptscotch_lib}
|
||||
HINTS ${PTSCOTCH_DIR}
|
||||
PATH_SUFFIXES lib lib32 lib64)
|
||||
endforeach()
|
||||
else()
|
||||
foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
|
||||
set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")
|
||||
find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY
|
||||
NAMES ${ptscotch_lib}
|
||||
HINTS ${_lib_env})
|
||||
NAMES ${ptscotch_lib}
|
||||
HINTS ${_lib_env})
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
@@ -255,7 +255,6 @@ foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})
|
||||
list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}")
|
||||
list(APPEND PTSCOTCH_LIBRARY_DIRS "${${ptscotch_lib}_lib_path}")
|
||||
else ()
|
||||
list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}")
|
||||
if (NOT PTSCOTCH_FIND_QUIETLY)
|
||||
message(STATUS "Looking for ptscotch -- lib ${ptscotch_lib} not found")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user