Skip to content
Snippets Groups Projects
Commit e2cdaa95 authored by Felix Gruber's avatar Felix Gruber Committed by Christoph Grüninger
Browse files

[cmake] link to arpack++ if found

The arpack++ package from Debian comes with a shared library that we
have to link to. Otherwise the linker will complain about missing
symbols when we try to build arpackpptest.
As there seem to be other versions of arpack++ that are header-only, we
only link to the shared library if it was found.
parent 4eb94d96
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,15 @@ find_path(ARPACKPP_INCLUDE_DIR
PATH_SUFFIXES "include" "include/arpack++"
)
# The arpack++ package in Debian also includes a shared library that we have
# to link to. Other versions of arpack++ are header-only.
# Thus we will later use the arpack++ shared library if found and just ignore
# it if it was not found.
find_library(ARPACKPP_LIBRARY
NAMES "arpack++"
PATH_SUFFIXES "lib" "lib32" "lib64"
)
# check header usability
include(CMakePushCheckState)
cmake_push_check_state()
......@@ -109,7 +118,14 @@ cmake_push_check_state()
# correctly in the CMake files."
if(ARPACKPP_INCLUDE_DIR)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ARPACKPP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ARPACK_LIBRARIES}) #${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${UMFPACK_LIBRARIES} ${SUPERLU_LIBRARIES}
if(ARPACKPP_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
${ARPACK_LIBRARIES}
${ARPACKPP_LIBRARY})
else(ARPACKPP_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
${ARPACK_LIBRARIES})
endif(ARPACKPP_LIBRARY)
endif(ARPACKPP_INCLUDE_DIR)
# end of header usability check
......@@ -129,7 +145,11 @@ mark_as_advanced(ARPACKPP_INCLUDE_DIR)
# if headers are found, store results
if(ARPACKPP_FOUND)
set(ARPACKPP_INCLUDE_DIRS ${ARPACKPP_INCLUDE_DIR})
set(ARPACKPP_LIBRARIES ${ARPACK_LIBRARIES}) #${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${UMFPACK_LIBRARIES} ${SUPERLU_LIBRARIES}
if(ARPACKPP_LIBRARY)
set(ARPACKPP_LIBRARIES ${ARPACKPP_LIBRARY} ${ARPACK_LIBRARIES})
else(ARPACKPP_LIBRARY)
set(ARPACKPP_LIBRARIES ${ARPACK_LIBRARIES})
endif(ARPACKPP_LIBRARY)
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determing location of ARPACK++ succeded:\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment