[libxslt] tests: Fix LIBXSLT_PLUGINS_PATH for multi-config CMake



commit 029b90bdfc6375b4a3c9ecc8152ccee2d8d00161
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Sep 7 22:59:27 2022 +0200

    tests: Fix LIBXSLT_PLUGINS_PATH for multi-config CMake
    
    Required for the MSVC tests.
    
    I wonder if there's an easier way to get the actual binary dir for
    multi-config CMake generators.

 CMakeLists.txt | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6272d1c..acb34341 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -377,11 +377,17 @@ if(LIBXSLT_WITH_TESTS)
                                PREFIX ""
                                OUTPUT_NAME xmlsoft_org_xslt_testplugin
                        )
+                       # There must be an easier way...
+                       get_cmake_property(MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG)
+                       if (MULTI_CONFIG)
+                               set(PLUGINS_PATH ${PROJECT_BINARY_DIR}/$<CONFIG>)
+                       else()
+                               set(PLUGINS_PATH ${PROJECT_BINARY_DIR})
+                       endif()
                        set_tests_properties(
                                runtest PROPERTIES
-                               ENVIRONMENT "LIBXSLT_PLUGINS_PATH=${CMAKE_CURRENT_BINARY_DIR}"
-                       )
-               endif()
+                               ENVIRONMENT LIBXSLT_PLUGINS_PATH=${PLUGINS_PATH}
+               )
        endif()
 
        if(Threads_FOUND)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]