CMake: Make qt-cmake-standalone-tests work from prefix build dir

We didn't copy the standalone test template files into the build dir
when configuring a prefix build.

We also need to copy the mkspecs.

Pick-to: 6.8
Change-Id: I517165b2b8db84b0766935e3d535a7a1ef2b6ad9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 587649deb7188d6944c31d991d0fd2a71f17ab4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 20dfcf4c59becea25d62121f617d7aacf099fc76)
This commit is contained in:
Alexandru Croitor 2025-06-05 13:23:49 +02:00 committed by Qt Cherry-pick Bot
parent 0e371a39ea
commit 897ebf2d67
2 changed files with 18 additions and 3 deletions

View File

@ -55,11 +55,21 @@ qt_install(FILES
DESTINATION "${__build_internals_install_dir}"
COMPONENT Devel
)
qt_path_join(__build_internals_standalone_test_template_path
"${CMAKE_CURRENT_SOURCE_DIR}"
"cmake/QtBuildInternals/${__build_internals_standalone_test_template_dir}")
qt_copy_or_install(
DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtBuildInternals/${__build_internals_standalone_test_template_dir}"
DIRECTORY "${__build_internals_standalone_test_template_path}"
DESTINATION "${__build_internals_install_dir}")
# In prefix builds we also need to copy the files into the build dir.
if(QT_WILL_INSTALL)
file(COPY "${__build_internals_standalone_test_template_path}"
DESTINATION "${__build_internals_install_dir}")
endif()
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtBuildInternals/${__build_internals_standalone_test_template_dir}/CMakeLists.txt")

View File

@ -137,7 +137,7 @@ macro(qt_internal_qtbase_install_mkspecs)
LIST_DIRECTORIES TRUE
"${PROJECT_SOURCE_DIR}/mkspecs/*")
foreach(entry IN LISTS mkspecs_subdirs)
if (IS_DIRECTORY ${entry})
if(IS_DIRECTORY ${entry})
qt_copy_or_install(DIRECTORY "${entry}"
DESTINATION ${mkspecs_install_dir}
USE_SOURCE_PERMISSIONS)
@ -145,6 +145,11 @@ macro(qt_internal_qtbase_install_mkspecs)
qt_copy_or_install(FILES "${entry}"
DESTINATION ${mkspecs_install_dir})
endif()
# In prefix builds we also need to copy the files into the build dir.
if(QT_WILL_INSTALL)
file(COPY "${entry}" DESTINATION "${mkspecs_install_dir}")
endif()
endforeach()
endmacro()