CMake: Fix qtbase cmake tests to pass when configured in-tree
As opposed to standalone tests. The problem is that 4 of the cmake failbuild tests use try_compile as an indirection layer to configure /another/ project which is actually the test. That project needs to know the location of Qt. To do that, a FindPackageHints.cmake file is included and the variable it sets is passed to find_package() HINTS option. That's enough to find a specific module, but not any dependent Tools packages. Work around that by adding the Qt location to CMAKE_PREFIX_PATH in the included FindPackageHints.cmake file. The problem does not happen in standalone tests, because the Qt location ends up being propagated via the qt toolchain file, which does get inherited by the compile tests (albeit in a weird way, where a reconfiguration still shows CMAKE_PREFIX_PATH to be empty). Change-Id: I1f7ce940fd31678b46c0356edf6581e523cb885a Fixes: QTBUG-86963 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
ba6175eb73
commit
3792b55022
@ -143,7 +143,10 @@ macro(_qt_internal_test_expect_fail _dir)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/${_dir}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}")
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/${_dir}/FindPackageHints.cmake" "set(Qt6Tests_PREFIX_PATH \"${CMAKE_PREFIX_PATH}\")")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/${_dir}/FindPackageHints.cmake"
|
||||
"set(Qt6Tests_PREFIX_PATH \"${CMAKE_PREFIX_PATH}\")
|
||||
list(APPEND CMAKE_PREFIX_PATH \"${CMAKE_PREFIX_PATH}\")
|
||||
")
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/failbuild/${_dir}/CMakeLists.txt"
|
||||
"
|
||||
|
Loading…
x
Reference in New Issue
Block a user