Update arpack-ng-config.cmake to match pkgconfig files

Removes the manual search for library files (where the static lib was
preferred by default), instead passes the library name as a -l flag so
the system can search for it in the preferred manner.

MPI libraries and includes should not be part of PARPACK's interface,
instead they belong in the equivalent of Libs.private/Requires.private
in the pkgconfig files.  Remove them.

PARPACK has no header files of its own.  Remove them from the
target_include_directories stuff.
This commit is contained in:
Kyle Guinn
2020-11-23 22:38:41 -06:00
parent a583f7d6a5
commit 1da025c2d3
+4 -20
View File
@@ -3,13 +3,12 @@
# To use arpack from CMake, use ARPACK::ARPACK target:
# find_package(arpack-ng)
# add_executable(main main.f)
# target_include_directories(main PUBLIC ARPACK::ARPACK)
# target_include_directories(main PRIVATE ARPACK::ARPACK)
# target_link_libraries(main ARPACK::ARPACK)
#
# To use parpack from CMake, use PARPACK::PARPACK target:
# find_package(arpack-ng)
# add_executable(main main.f)
# target_include_directories(main PUBLIC PARPACK::PARPACK)
# target_link_libraries(main PARPACK::PARPACK)
# Create local variables.
@@ -18,24 +17,9 @@ set(exec_prefix "@exec_prefix@")
set(libdir "@libdir@")
set(includedir "@includedir@")
set(arpack_ng_INCLUDE_DIRS "${includedir}/arpack;${MPI_Fortran_INCLUDE_DIRS};${MPI_C_INCLUDE_DIRS};${MPI_CXX_INCLUDE_DIRS}")
if(EXISTS "${libdir}/libarpack.a")
set(arpack_ng_LIBRARIES "${libdir}/libarpack.a")
elseif(EXISTS "${libdir}/libarpack.so")
set(arpack_ng_LIBRARIES "${libdir}/libarpack.so")
endif()
if(EXISTS "${libdir}/libparpack.a")
set(parpack_ng_LIBRARIES "${libdir}/libparpack.a;${arpack_ng_LIBRARIES};${MPI_Fortran_LIBRARIES};${MPI_C_LIBRARIES};${MPI_CXX_LIBRARIES}")
elseif(EXISTS "${libdir}/libparpack.so")
set(parpack_ng_LIBRARIES "${libdir}/libparpack.so;${arpack_ng_LIBRARIES};${MPI_Fortran_LIBRARIES};${MPI_C_LIBRARIES};${MPI_CXX_LIBRARIES}")
endif()
# Create arpack targets.
add_library(ARPACK::ARPACK INTERFACE IMPORTED)
set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${arpack_ng_INCLUDE_DIRS}")
set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${arpack_ng_LIBRARIES}")
set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${includedir}/arpack")
set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "arpack")
add_library(PARPACK::PARPACK INTERFACE IMPORTED)
set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${arpack_ng_INCLUDE_DIRS}")
set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${parpack_ng_LIBRARIES}")
set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "parpack")