From f16ba664838e7c5a6bc0507a84b7d879a0dbbf35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Wed, 8 Jan 2025 15:19:09 +0100
Subject: [PATCH] Use PUGS_PREFIX_PATH to define pugs installation dir for
 plugins [ci-skip]

- the environment variable PUGS_INSTALL_DIR is no more used
- also fix HDF5 detection on ubuntu for plugins
---
 tools/plugin-template/CMakeLists.txt-template | 13 +++++++------
 tools/plugin-template/README.md-template      |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/plugin-template/CMakeLists.txt-template b/tools/plugin-template/CMakeLists.txt-template
index 0cafe6d46..9c6478b07 100644
--- a/tools/plugin-template/CMakeLists.txt-template
+++ b/tools/plugin-template/CMakeLists.txt-template
@@ -2,12 +2,12 @@ cmake_minimum_required (VERSION 3.19)
 
 project("_PLUGIN_LOW_")
 
-if (NOT PUGS_PREFIX_PATH)
-  if (DEFINED ENV{PUGS_INSTALL_DIR})
-    message(STATUS "Looking for pugs in ${PUGS_INSTALL_DIR}")
-  else()
-    message(FATAL_ERROR "you must set PUGS_INSTALL_DIR environment variable")
-  endif()
+set(PUGS_PREFIX_PATH "" CACHE STRING "pugs intall dir")
+
+string(COMPARE EQUAL "${PUGS_PREFIX_PATH}" "" pugs_prefix_undefined)
+
+if (pugs_prefix_undefined)
+  message(FATAL_ERROR "PUGS_PREFIX_PATH must be defined")
 endif()
 
 # CMake utils
@@ -23,6 +23,7 @@ find_package(Pugs REQUIRED)
 list(APPEND CMAKE_MODULE_PATH "${PUGS_PREFIX_PATH}/lib/cmake/Kokkos")
 include(KokkosConfig)
 
+set(HDF5_PREFER_PARALLEL TRUE)
 list(APPEND CMAKE_MODULE_PATH "${PUGS_PREFIX_PATH}/lib/cmake/HighFive")
 include(HighFiveConfig)
 
diff --git a/tools/plugin-template/README.md-template b/tools/plugin-template/README.md-template
index d89c74f97..4db107171 100644
--- a/tools/plugin-template/README.md-template
+++ b/tools/plugin-template/README.md-template
@@ -32,7 +32,7 @@ make install
 
 In the build directory one runs
 ```shell
-PUGS_INSTALL_DIR=pugs_install_dir cmake _PLUGIN_LOW__dir
+cmake -DPUGS_PREFIX_PATH=pugs_install_dir _PLUGIN_LOW__dir
 ```
 where `pugs_install_dir` has the same value as above and `_PLUGIN_LOW__dir`
 is the directory that contains this `README.md` file.
-- 
GitLab