From c642c4b15cc3ed6da70f6f4c61006a016bc8e0ba 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 a0731941b2..7e5708b342 100644 --- a/extras/CatchAddTests.cmake +++ b/extras/CatchAddTests.cmake @@ -36,6 +36,7 @@ function(catch_discover_tests_impl) set(output_prefix ${_TEST_OUTPUT_PREFIX}) set(output_suffix ${_TEST_OUTPUT_SUFFIX}) set(dl_paths ${_TEST_DL_PATHS}) + set(environment_modifications "") set(script) set(suite) set(tests) @@ -56,7 +57,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() @@ -117,7 +120,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()