CMake: Fix creation of forwarding headers to be at configure time

qt_add_module checks for the existence of the following directory
include/QtFoo/6.0.0/Foo when deciding whether a private module target
should contain that path in its INTERFACE_INCLUDE_DIRECTORIES.

There are 2 cases when it's created, when running syncqt, and inside
qt_install_injections. If syncqt doesn't create it because there are no
private headers (like in qttools/src/global), qt_install_injections
created it at generation time (for injected configure headers like
qttools-config_p.h)

Unfortunately that caused the existence check mentioned above to fail,
not exporting the path in the QtToolsPrivate's include directories,
and failing the qttools build.

To fix that, create the injection files (and directories) at configure
time, using qt_configure_file instead of file(GENERATE).

Change-Id: Idd9b6ec36e986c4de95d11557170e1c70927211c
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexandru Croitor 2020-03-20 15:07:28 +01:00
parent e510a4e327
commit 7c04c5427f

View File

@ -1318,7 +1318,8 @@ function(qt_install_injections target build_dir install_dir)
"${lower_case_forwarding_header_path}"
"${current_repo_build_dir}/${file}")
set(main_contents "#include \"${relpath}\"")
file(GENERATE OUTPUT "${lower_case_forwarding_header_path}/${original_file_name}"
qt_configure_file(OUTPUT "${lower_case_forwarding_header_path}/${original_file_name}"
CONTENT "${main_contents}")
if(is_framework)
@ -1348,7 +1349,7 @@ function(qt_install_injections target build_dir install_dir)
endif()
# Generate upper case forwarding header like QVulkanFunctions or QtConfig.
file(GENERATE OUTPUT "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}"
qt_configure_file(OUTPUT "${build_dir}/${upper_case_forwarding_header_path}/${fwd_hdr}"
CONTENT "#include \"${destinationname}\"\n")
if(is_framework)