conda-forge / sundials-feedstock

A conda-smithy repository for sundials.
BSD 3-Clause "New" or "Revised" License
4 stars 10 forks source link

Error finding suitesparse/KLU header when linking to sundials/sunlinsol_klu #107

Closed davidsulonabm closed 5 months ago

davidsulonabm commented 6 months ago

Comment:

I am trying to upgrade from sundials 6.6 to 7.0, and get the following error when building a project (call it target) that links to sundials and the KLU linear solver using cmake:

...path/to/env/include/sunlinsol/sunlinsol_klu.h:34:10: fatal error: 'klu.h' file not found
   34 | #include <klu.h>

The relevant parts of my CMakeLists.txt are

find_library(SUNDIALS_CVODES_LIB sundials_cvodes)
find_library(SUNDIALS_SUNLINSOLKLU_LIB sundials_sunlinsolklu)

target_link_libraries(target PRIVATE "${SUNDIALS_CVODES_LIB}" PRIVATE "${SUNDIALS_SUNLINSOLKLU_LIB}")
target_include_directories(target PRIVATE "${CMAKE_INCLUDE_PATH}")

(CMAKE_INCLUDE_PATH is path/to/env/include). I understand suitesparse update changed where the headers are installed; adding ${CMAKE_INCLUDE_PATH}/suitesparse to the target_include_directories could serve as a workaround, but this is not ideal, as this is not a direct dependency of target.

I may be missing something but, is this perhaps an issue with the install?

jschueller commented 5 months ago

it works using the imported target "sunlinsolklu_shared":

target_link_libraries(target SUNDIALS::sunlinsolklu_shared)