Tests: Fix RunCMake.CommandLine test in unusual environments

Modify `Tests/RunCMake/CommandLine/P_working-dir.cmake` to not spuriously
fail in environments when the build directory's nominal path is not
canonicalized (i.e. `realpath(BINDIR) != BINDIR`).
This commit is contained in:
Matthew Woehlke
2022-09-09 12:58:17 -04:00
committed by Brad King
parent 83686df1d6
commit 7b62e40a64

View File

@@ -9,6 +9,11 @@ foreach(d CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRE
if(EXPECTED_WORKING_DIR STREQUAL "${${d}}")
message(STATUS "${d} is the expected working directory (${EXPECTED_WORKING_DIR})")
else()
message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})")
get_filename_component(resolved "${EXPECTED_WORKING_DIR}" REALPATH)
if(resolved STREQUAL "${${d}}")
message(STATUS "${d} is the expected working directory (${resolved}) after symlink resolution")
else()
message(FATAL_ERROR "${d} = \"${${d}}\" is not the expected working directory (${EXPECTED_WORKING_DIR})")
endif()
endif()
endforeach()