summaryrefslogtreecommitdiff
path: root/Meta/Lagom
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-02-01 08:36:15 -0500
committerTim Flynn <trflynn89@pm.me>2023-02-01 12:28:02 -0500
commit1bbd889f67c6a5bd30eb8d169275087fde032d73 (patch)
tree28ffd02f8e889912062ea21b4cbf908c8a54d455 /Meta/Lagom
parent0a97206a25a1a8225a6e89e7804526cb5abfc3b1 (diff)
downloadserenity-1bbd889f67c6a5bd30eb8d169275087fde032d73.zip
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).
Diffstat (limited to 'Meta/Lagom')
-rw-r--r--Meta/Lagom/CMakeLists.txt8
1 files 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}" "$<TARGET_FILE:$ENV{LAGOM_TARGET}>" $ENV{LAGOM_ARGS}
+ WORKING_DIRECTORY "$<TARGET_PROPERTY:$ENV{LAGOM_TARGET},LAGOM_WORKING_DIRECTORY>"
DEPENDS "$<TARGET_FILE:$ENV{LAGOM_TARGET}>"
USES_TERMINAL
VERBATIM