From 0040c7fd9b42b500be6783e198d3dc0eecd801f1 Mon Sep 17 00:00:00 2001
From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
Date: Wed, 28 Jul 2021 14:48:06 -0700
Subject: [PATCH] Tweak test projects so the console window remains open
(#2380)
* tweak test projects so the console window remains open
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
* doing it for all test projects
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
* newline at the end of the file to make devs happy
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
---
cmake/LYTestWrappers.cmake | 9 +++++++++
cmake/Platform/Common/Directory.Build.props | 7 ++++++-
cmake/Platform/Common/TestProject.props | 16 ++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 cmake/Platform/Common/TestProject.props
diff --git a/cmake/LYTestWrappers.cmake b/cmake/LYTestWrappers.cmake
index 535f00f58d..efb19a20dd 100644
--- a/cmake/LYTestWrappers.cmake
+++ b/cmake/LYTestWrappers.cmake
@@ -219,8 +219,17 @@ function(ly_add_test)
VS_DEBUGGER_COMMAND_ARGUMENTS "${test_arguments_line}"
)
+ # In the case where we are creating a custom target, we need to add dependency to the target
+ if(ly_add_test_PARENT_NAME AND NOT ${ly_add_test_NAME} STREQUAL ${ly_add_test_PARENT_NAME})
+ ly_add_dependencies(${unaliased_test_name} ${ly_add_test_PARENT_NAME})
+ endif()
+
endif()
+ # For test projects that are custom targets, pass a props file that sets the project as "Console" so
+ # it leaves the console open when it finishes
+ set_target_properties(${unaliased_test_name} PROPERTIES VS_USER_PROPS "${LY_ROOT_FOLDER}/cmake/Platform/Common/TestProject.props")
+
# Include additional dependencies
if (ly_add_test_RUNTIME_DEPENDENCIES)
ly_add_dependencies(${unaliased_test_name} ${ly_add_test_RUNTIME_DEPENDENCIES})
diff --git a/cmake/Platform/Common/Directory.Build.props b/cmake/Platform/Common/Directory.Build.props
index 73aa984073..76e4b28922 100644
--- a/cmake/Platform/Common/Directory.Build.props
+++ b/cmake/Platform/Common/Directory.Build.props
@@ -17,7 +17,12 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
- TurnOffAllWarnings
+
+ TurnOffAllWarnings
+
+
\ No newline at end of file
diff --git a/cmake/Platform/Common/TestProject.props b/cmake/Platform/Common/TestProject.props
new file mode 100644
index 0000000000..dff509b7ff
--- /dev/null
+++ b/cmake/Platform/Common/TestProject.props
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+ Console
+
+
+