From d313179917dc1f64286f09c3efa0a6d496897d68 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 24 Oct 2022 16:25:10 -0400 Subject: [PATCH] add compatibility to VTK version 9.0 and above --- cmake/Modules/Packages/VTK.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/Packages/VTK.cmake b/cmake/Modules/Packages/VTK.cmake index 8c4445167a..a0de1e0ff4 100644 --- a/cmake/Modules/Packages/VTK.cmake +++ b/cmake/Modules/Packages/VTK.cmake @@ -1,4 +1,9 @@ find_package(VTK REQUIRED NO_MODULE) -include(${VTK_USE_FILE}) target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK) -target_link_libraries(lammps PRIVATE ${VTK_LIBRARIES}) +if (VTK_MAJOR_VERSION VERSION_LESS 9.0) + include(${VTK_USE_FILE}) + target_link_libraries(lammps PRIVATE ${VTK_LIBRARIES}) +else() + target_link_libraries(lammps PRIVATE VTK::CommonCore VTK::IOCore VTK::CommonDataModel VTK::IOXML VTK::IOLegacy VTK::IOParallelXML) + vtk_module_autoinit(TARGETS lammps MODULES VTK::CommonCore VTK::IOCore VTK::CommonDataModel VTK::IOXML VTK::IOLegacy VTK::IOParallelXML) +endif()