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 6.9 6.10
Change-Id: I517165b2b8db84b0766935e3d535a7a1ef2b6ad9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2025-06-05 13:23:49 +02:00
parent 1ede87a735
commit 587649deb7
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()