From: Drew Parsons <dparsons@debian.org>
Date: Sun, 20 Aug 2023 23:34:08 +0200
Subject: fixes plugin path to test EncryptionOperator

libEncryptionOperator.so got built in main libdir, not a plugin
subdir. Original source set ADIOS2_PLUGIN_PATH to cmake subdir not the
libdir.  Likewise EnginePlugin.
---
 plugins/operators/CMakeLists.txt                  | 5 +++--
 testing/install/EncryptionOperator/CMakeLists.txt | 3 ++-
 testing/install/EnginePlugin/CMakeLists.txt       | 2 ++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/plugins/operators/CMakeLists.txt b/plugins/operators/CMakeLists.txt
index abea93e..25b8a02 100644
--- a/plugins/operators/CMakeLists.txt
+++ b/plugins/operators/CMakeLists.txt
@@ -4,6 +4,7 @@
 #------------------------------------------------------------------------------#
 
 if(ADIOS2_HAVE_Sodium)
+  string(REPLACE "_" "" ADIOS2_LIBRARY_FLAVOR ${ADIOS2_LIBRARY_SUFFIX})
   add_library(EncryptionOperator MODULE
     EncryptionOperator.cpp
   )
@@ -13,7 +14,7 @@ if(ADIOS2_HAVE_Sodium)
   endif()
   install(TARGETS EncryptionOperator  EXPORT adios2Exports
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_core-runtime
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-libraries NAMELINK_COMPONENT adios2_core-development
-    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT adios2_core-development
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/adios2/${ADIOS2_LIBRARY_FLAVOR}/plugins COMPONENT adios2_core-libraries NAMELINK_COMPONENT adios2_core-development
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/adios2/${ADIOS2_LIBRARY_FLAVOR}/plugins COMPONENT adios2_core-development
 )
 endif()
diff --git a/testing/install/EncryptionOperator/CMakeLists.txt b/testing/install/EncryptionOperator/CMakeLists.txt
index aca5c62..7407038 100644
--- a/testing/install/EncryptionOperator/CMakeLists.txt
+++ b/testing/install/EncryptionOperator/CMakeLists.txt
@@ -8,10 +8,11 @@ project(adios_operator_plugin_test CXX)
 enable_testing()
 
 find_package(adios2 REQUIRED)
+string(REPLACE "_" "" ADIOS2_LIBRARY_FLAVOR ${ADIOS2_LIBRARY_SUFFIX})
 
 option(BUILD_SHARED_LIBS "build shared libs" ON)
 
-set(ENV{ADIOS2_PLUGIN_PATH} "${adios2_DIR}/../../")
+set(ENV{ADIOS2_PLUGIN_PATH} "${adios2_DIR}/../../../adios2/${ADIOS2_LIBRARY_FLAVOR}/plugins")
 
 #---------- Operator Plugin Tests
 
diff --git a/testing/install/EnginePlugin/CMakeLists.txt b/testing/install/EnginePlugin/CMakeLists.txt
index 2949290..34f9f66 100644
--- a/testing/install/EnginePlugin/CMakeLists.txt
+++ b/testing/install/EnginePlugin/CMakeLists.txt
@@ -15,6 +15,8 @@ option(BUILD_SHARED_LIBS "build shared libs" ON)
 
 include(GenerateExportHeader)
 
+set(ENV{ADIOS2_PLUGIN_PATH} "${adios2_DIR}/../../../adios2/${ADIOS2_LIBRARY_FLAVOR}/plugins/")
+
 add_library(PluginEngineWrite
   ../../../examples/plugins/engine/ExampleWritePlugin.cpp
 )
