From 98543f0a13c7850f04c9982ad7bce23fcfcd3fcd Mon Sep 17 00:00:00 2001 From: Leander Beernaert Date: Wed, 19 Feb 2020 13:24:22 +0100 Subject: [PATCH] Fix PATH environment variable for CMake tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes setting the correct value for the PATH environment value. Currently, due to Windows' ; path separator, every list entry was treated as a separate environment variable that need to be set instead of properly extending the PATH list. Change-Id: Ib2fc031397459370beec84f9cb4ec6df7db00df3 Reviewed-by: Alexandru Croitor Reviewed-by: MÃ¥rten Nordheim --- cmake/QtBuild.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 98cc1aeccf3..9949f6bb20f 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -2740,7 +2740,9 @@ function(qt_add_test name) endif() # Get path to qtbase/bin, then prepend this path containing the shared libraries to PATH set(INSTALL_PREFIX_BIN "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}") - set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "PATH=${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}${INSTALL_PREFIX_BIN}${QT_PATH_SEPARATOR}$ENV{PATH}") + set(test_env_path "PATH=${CMAKE_CURRENT_BINARY_DIR}${QT_PATH_SEPARATOR}${INSTALL_PREFIX_BIN}${QT_PATH_SEPARATOR}$ENV{PATH}") + string(REPLACE ";" "\;" test_env_path "${test_env_path}") + set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "${test_env_path}") set_property(TEST "${name}" APPEND PROPERTY ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST=1") # Add the install prefix to list of plugin paths when doing a prefix build