From bc2dad1d8e4c0d5e7de8f12351b67d7fc73adb33 Mon Sep 17 00:00:00 2001 From: Peter Hill Date: Tue, 6 Jan 2026 14:56:42 +0000 Subject: [PATCH] cmake: Set `_ROOT` variable from corresponding `_DIR` Using the build directory directly for some dependencies (sometimes?) doesn't set the `_ROOT` variable, causing issues with our `bout++Config.cmake` file. --- cmake/SetupBOUTThirdParty.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/SetupBOUTThirdParty.cmake b/cmake/SetupBOUTThirdParty.cmake index 53ceb4351c..1256fbbeba 100644 --- a/cmake/SetupBOUTThirdParty.cmake +++ b/cmake/SetupBOUTThirdParty.cmake @@ -186,6 +186,12 @@ if (BOUT_USE_NETCDF) set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${NETCDF_LDFLAGS_STRING}") endif() endif() + if (netCDF_DIR) + set(netCDF_ROOT "${netCDF_DIR}") + endif() + if (netCDFCxx_DIR) + set(netCDFCxx_ROOT "${netCDFCxx_DIR}") + endif() endif() message(STATUS "NetCDF support: ${BOUT_USE_NETCDF}") set(BOUT_HAS_NETCDF ${BOUT_USE_NETCDF}) @@ -299,6 +305,9 @@ if (BOUT_USE_SUNDIALS) message(FATAL_ERROR "SUNDIALS_VERSION 4.0.0 or newer is required. Found version ${SUNDIALS_VERSION}.") endif() endif() + if (SUNDIALS_DIR) + set(SUNDIALS_ROOT "${SUNDIALS_DIR}") + endif() target_link_libraries(bout++ PUBLIC SUNDIALS::nvecparallel) target_link_libraries(bout++ PUBLIC SUNDIALS::cvode) target_link_libraries(bout++ PUBLIC SUNDIALS::ida)