Closed WeiqunZhang closed 4 months ago
@balos1 I am able to compile and run with both sundials 6 and 7 using gnu make. But there are still some issues with cmake. SUNDIALS::core
is only available in v7. So I made it an optional component and check if it's found after find_package is called. But I got the following error,
CMake Error at Tools/CMake/AMReXThirdPartyLibraries.cmake:148 (find_package):
Could not find a configuration file for package "SUNDIALS" that is
compatible with requested version "6.0.0".
The following configuration files were considered but not accepted:
/home/wqzhang/mygitrepo/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.4.0/sundials-develop-5wskgac5smdxvywok7yuojfsk6jfzr6a/lib/cmake/sundials/SUNDIALSConfig.cmake, version: 7.0.0
Is version 7.0.0 considered incompatible with 6.0.0 in the sundials' cmake config file? If we want to support both v7 and v6, how should we handle this?
@ax3l
Note that if I simply set the minimum version to 7.0.0 with core as optional, it works.
@WeiqunZhang Unfortunately it looks like we setup the CMake version file for SUNDIALS with the SameMajorVersion
compatibility mode. Im going to change it to AnyNewerVersion
, but that doesn't fix the problem for 7.0.0. The workaround is to either do find_package
twice (once with minimum 6.0.0 and once with minimum 7.0.0, check if NOT SUNDIALS_FOUND
after the first one), or check the version manually like this:
find_package(SUNDIALS CONFIG REQUIRED
COMPONENTS ${SUNDIALS_COMPONENTS}
OPTIONAL_COMPONENTS core)
set(SUNDIALS_MINIMUM_VERSION 6.0.0)
if (SUNDIALS_VERSION VERSION_LESS ${SUNDIALS_MINIMUM_VERSION})
message(FATAL_ERROR "SUNDIALS ${SUNDIALS_MINIMUM_VERSION} or newer is required. Found version ${SUNDIALS_VERSION}.")
endif()
This is the rebirth of #3756. But it's compatible with SUNDIALS 6.