瀏覽代碼

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`.
Brad King 3 年之前
父節點
當前提交
1d3a98456d
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 4 2
      Tests/QtAutogen/MocInclude/CMakeLists.txt
  2. 3 1
      Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt

+ 4 - 2
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
 

+ 3 - 1
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)