diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in index c10d2a319..9a5f04231 100644 --- a/Tests/EnforceConfig.cmake.in +++ b/Tests/EnforceConfig.cmake.in @@ -27,3 +27,10 @@ IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) ENDIF(NOT CTEST_CONFIGURATION_TYPE) MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) + +# Fake a user home directory to avoid polluting the real one. +IF(DEFINED ENV{HOME}) + SET(HOME "@CMake_BINARY_DIR@/Tests/CMakeFiles/TestHome") + FILE(MAKE_DIRECTORY "${HOME}") + SET(ENV{HOME} "${HOME}") +ENDIF(DEFINED ENV{HOME})