From 1538be67cb8a8b85fd3d5e7e569e46db75f8e284 Mon Sep 17 00:00:00 2001 From: Chien-Yu Lin Date: Fri, 21 Jun 2024 14:36:04 +0800 Subject: [PATCH] Respect path order of DL_PATHS in catch_discover_tests function --- extras/CatchAddTests.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extras/CatchAddTests.cmake b/extras/CatchAddTests.cmake index 604e097a..da302a4a 100644 --- a/extras/CatchAddTests.cmake +++ b/extras/CatchAddTests.cmake @@ -37,6 +37,7 @@ function(catch_discover_tests_impl) set(output_suffix ${_TEST_OUTPUT_SUFFIX}) set(dl_paths ${_TEST_DL_PATHS}) set(dl_framework_paths ${_TEST_DL_FRAMEWORK_PATHS}) + set(environment_modifications "") set(script) set(suite) set(tests) @@ -57,7 +58,9 @@ function(catch_discover_tests_impl) endif() if(dl_paths) - cmake_path(CONVERT "${dl_paths}" TO_NATIVE_PATH_LIST paths) + cmake_path(CONVERT "$ENV{${dl_paths_variable_name}}" TO_NATIVE_PATH_LIST env_dl_paths) + list(PREPEND env_dl_paths "${dl_paths}") + cmake_path(CONVERT "${env_dl_paths}" TO_NATIVE_PATH_LIST paths) set(ENV{${dl_paths_variable_name}} "${paths}") endif() @@ -123,7 +126,7 @@ function(catch_discover_tests_impl) if(dl_paths) foreach(path ${dl_paths}) cmake_path(NATIVE_PATH path native_path) - list(APPEND environment_modifications "${dl_paths_variable_name}=path_list_prepend:${native_path}") + list(PREPEND environment_modifications "${dl_paths_variable_name}=path_list_prepend:${native_path}") endforeach() endif()