diff options
author | Brad King <brad.king@kitware.com> | 2022-02-25 16:32:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-25 16:32:04 (GMT) |
commit | 1d3a98456d0191995ebd53f67cc70a5f4bcb680d (patch) | |
tree | f79fb7f7ea70058c9178d267af9a9d207bd123ee /Tests | |
parent | 0883ab385a8d15075cab99a265a20131a37b506d (diff) | |
download | CMake-1d3a98456d0191995ebd53f67cc70a5f4bcb680d.zip CMake-1d3a98456d0191995ebd53f67cc70a5f4bcb680d.tar.gz CMake-1d3a98456d0191995ebd53f67cc70a5f4bcb680d.tar.bz2 |
Tests: Fix Qt*Autogen.MocIncludeSymlink test on Windows
This test runs the `Tests/QtAutogen/MocInclude` test inside symlinked
directories. The `MocInclude` test previously relied on
`get_filename_component(... REALPATH)` to get the real source tree
location and compute the path to `AutogenCoreTest.cmake` from it.
However, this does not work on Windows due to issue #17206. The
test has been passing on Windows only on machines where symlinks
cannot be created and the main part of the test is skipped. On
machines where symlinks can be created, the test failed with that
approach. Fix it by explicitly passing the path to the helper
script in as a cache entry. Avoid relying on `REALPATH`.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/QtAutogen/MocInclude/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Tests/QtAutogen/MocInclude/CMakeLists.txt b/Tests/QtAutogen/MocInclude/CMakeLists.txt index 4224d2f..c62128b 100644 --- a/Tests/QtAutogen/MocInclude/CMakeLists.txt +++ b/Tests/QtAutogen/MocInclude/CMakeLists.txt @@ -1,7 +1,9 @@ cmake_minimum_required(VERSION 3.16) project(MocInclude) -get_filename_component(CS_REAL ${CMAKE_CURRENT_SOURCE_DIR} REALPATH) -include("${CS_REAL}/../AutogenCoreTest.cmake") +if (NOT DEFINED AUTOGEN_CORE_TEST_CMAKE) + get_filename_component(AUTOGEN_CORE_TEST_CMAKE "../AutogenCoreTest.cmake" ABSOLUTE) +endif() +include("${AUTOGEN_CORE_TEST_CMAKE}") # Test moc include patterns diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt index c28616b..cf60555 100644 --- a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt +++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.16) project(MocIncludeSymlink) -include("../AutogenCoreTest.cmake") +get_filename_component(AUTOGEN_CORE_TEST_CMAKE "../AutogenCoreTest.cmake" ABSOLUTE) +include("${AUTOGEN_CORE_TEST_CMAKE}") # # Tests if MocInclude can be build when @@ -65,6 +66,7 @@ macro(buildMocInclude sourceDir binaryDir) "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}" "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + "-DAUTOGEN_CORE_TEST_CMAKE:STRING=${AUTOGEN_CORE_TEST_CMAKE}" OUTPUT_VARIABLE output ) if (result) |