From 1bbd889f67c6a5bd30eb8d169275087fde032d73 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 1 Feb 2023 08:36:15 -0500 Subject: [PATCH] Meta: Set the Lagom test working directory for run-lagom-target When we call add_test() from each test's CMakeLists.txt, we specify the working directory to be that of the CMakeList.txt file itself. Create a property to store that directory and reference it when run-lagom-target is invoked by serenity.sh. Note that for non-test Lagom targets which do not set this property, the working directory will be Build/lagom (because the property will be the empty string, which CMake resolves relative to the current build path). --- Meta/Lagom/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 1291bf0d51..99ffc6db44 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -253,10 +253,11 @@ function(lagom_test source) add_executable(${name} ${source}) target_link_libraries(${name} PRIVATE LibCore LibTest LibTestMain ${LAGOM_TEST_LIBS}) add_test( - NAME ${name} - COMMAND ${name} - WORKING_DIRECTORY ${LAGOM_TEST_WORKING_DIRECTORY} + NAME ${name} + COMMAND ${name} + WORKING_DIRECTORY ${LAGOM_TEST_WORKING_DIRECTORY} ) + set_target_properties(${name} PROPERTIES LAGOM_WORKING_DIRECTORY "${LAGOM_TEST_WORKING_DIRECTORY}") endfunction() function(serenity_test test_src sub_dir) @@ -693,6 +694,7 @@ endif() if (NOT "$ENV{LAGOM_TARGET}" STREQUAL "") add_custom_target(run-lagom-target COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT}" "$" $ENV{LAGOM_ARGS} + WORKING_DIRECTORY "$" DEPENDS "$" USES_TERMINAL VERBATIM