From 86295c8d89d738b8cb2acffe2dbf5dc050cc1beb Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Thu, 2 Feb 2023 15:01:55 +0100 Subject: [PATCH] Make qt6_extract_metatypes respects the AUTOGEN_BUILD_DIR, if set If AUTOGEN_BUILD_DIR is set, _qt_internal_get_target_autogen_build_dir returns that; otherwise, the default builddir/${target}_autogen will be returned. Pick-to: 6.5 Task-number: QTBUG-110696 Change-Id: I028058bd0176c25bc4bc66be8abcae4f7e43a0f2 Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreMacros.cmake | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 4cc8804a27e..1c2199bb28f 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -903,6 +903,16 @@ function(_qt_internal_assign_to_internal_targets_folder target) endif() endfunction() +function(_qt_internal_get_target_autogen_build_dir target out_var) + get_property(target_autogen_build_dir TARGET ${target} PROPERTY AUTOGEN_BUILD_DIR) + if(target_autogen_build_dir) + set(${out_var} "${target_autogen_build_dir}" PARENT_SCOPE) + else() + get_property(target_binary_dir TARGET ${target} PROPERTY BINARY_DIR) + set(${out_var} "${target_binary_dir}/${target}_autogen" PARENT_SCOPE) + endif() +endfunction() + function(qt6_extract_metatypes target) get_target_property(existing_meta_types_file ${target} INTERFACE_QT_META_TYPES_BUILD_FILE) @@ -950,6 +960,9 @@ function(qt6_extract_metatypes target) set(type_list_file "${target_binary_dir}/meta_types/${target}_json_file_list.txt") set(type_list_file_manual "${target_binary_dir}/meta_types/${target}_json_file_list_manual.txt") + set(target_autogen_build_dir "") + _qt_internal_get_target_autogen_build_dir(${target} target_autogen_build_dir) + get_target_property(uses_automoc ${target} AUTOMOC) set(automoc_args) set(automoc_dependencies) @@ -965,13 +978,13 @@ function(qt6_extract_metatypes target) set(cmake_autogen_cache_file "${target_binary_dir}/CMakeFiles/${target}_autogen.dir/ParseCache.txt") set(multi_config_args - --cmake-autogen-include-dir-path "${target_binary_dir}/${target}_autogen/include" + --cmake-autogen-include-dir-path "${target_autogen_build_dir}/include" ) else() set(cmake_autogen_cache_file "${target_binary_dir}/CMakeFiles/${target}_autogen.dir/ParseCache_$.txt") set(multi_config_args - --cmake-autogen-include-dir-path "${target_binary_dir}/${target}_autogen/include_$" + --cmake-autogen-include-dir-path "${target_autogen_build_dir}/include_$" "--cmake-multi-config") endif() @@ -1033,7 +1046,7 @@ function(qt6_extract_metatypes target) _qt_internal_assign_to_internal_targets_folder(${target}_automoc_json_extraction) else() set(cmake_autogen_timestamp_file - "${target_binary_dir}/${target}_autogen/timestamp" + "${target_autogen_build_dir}/timestamp" ) add_custom_command(OUTPUT ${type_list_file}