Fix output files of the *_header_check targets

Header files of a Qt module are usually found in subdirectories.
Avoid creating object file paths like "header_foo/bar.h.o".
When building with conan, the "header_foo" subdirectory was not created
for whatever reason.

Now, we make sure we have clean object file paths, e.g.
"header_check/foo/bar.h.o", and we create the directory upfront before
invoking the compiler.

Pick-to: dev
Fixes: QTBUG-90529
Change-Id: Ifa5d6b97e07fc4e249c58cda5128439d60b14f5f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2021-01-26 14:53:13 +01:00
parent 9b43d8a98a
commit 54980200c7

View File

@ -162,13 +162,15 @@ function(qt_internal_add_headers_clean_target
foreach(header ${hclean_headers})
get_filename_component(input_path "${header}" ABSOLUTE)
set(artifact_path "header_${header}.o")
set(artifact_path "header_check/${header}.o")
get_filename_component(artifact_directory "${artifact_path}" DIRECTORY)
set(comment_header_path "${CMAKE_CURRENT_SOURCE_DIR}/${header}")
file(RELATIVE_PATH comment_header_path "${PROJECT_SOURCE_DIR}" "${comment_header_path}")
add_custom_command(
OUTPUT "${artifact_path}"
COMMENT "headersclean: Checking header ${comment_header_path}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${artifact_directory}"
COMMAND
${compiler_to_run} -c ${cxx_flags}
"${target_compile_flags_joined_genex}"