diff options
author | Michal Klocek <michal.klocek@qt.io> | 2022-05-18 08:01:29 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2022-06-02 15:29:40 +0200 |
commit | d4183db69bb3ec7baeac63118a51c0f511264689 (patch) | |
tree | ee3408efb68ae4f1fcd324d59847d842f99e6644 | |
parent | 2d871ea9b757813d4fcaddd21a5cb58989905a21 (diff) |
Fix unsupported @file notation on macos archiver
Create intermediate object file and use it as
imported object library.
Pick-to: dev 6.2
Fixes: QTBUG-103579
Change-Id: I2ff7d57509ab1f071876de3b6fdc5ed9874c4697
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | cmake/Functions.cmake | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 89f4cdd39..e66aa0694 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -408,7 +408,18 @@ function(get_copy_of_response_file result target rsp) add_dependencies(${cmakeTarget} ${cmakeTarget}_${rsp}_copy_${config}) endfunction() -function(extend_cmake_target target buildDir completeStatic) +function(add_archiver_options target buildDir completeStatic) + get_target_property(config ${target} CONFIG) + string(TOUPPER ${config} cfg) + get_target_property(ninjaTarget ${target} NINJA_TARGET) + get_target_property(cmakeTarget ${target} CMAKE_TARGET) + set(objects_out "${buildDir}/${cmakeTarget}_objects.o") + add_library(GnObject_${cmakeTarget}_${config} OBJECT IMPORTED GLOBAL) + target_link_libraries(${cmakeTarget} PRIVATE $<$<CONFIG:${config}>:GnObject_${cmakeTarget}_${config}>) + set_property(TARGET GnObject_${cmakeTarget}_${config} PROPERTY IMPORTED_OBJECTS_${cfg} ${objects_out}) +endfunction() + +function(add_linker_options target buildDir completeStatic) get_target_property(config ${target} CONFIG) get_target_property(ninjaTarget ${target} NINJA_TARGET) get_target_property(cmakeTarget ${target} CMAKE_TARGET) @@ -452,7 +463,7 @@ function(extend_cmake_target target buildDir completeStatic) endif() endfunction() -function(add_rsp_command target buildDir completeStatic) +function(add_intermediate_archive target buildDir completeStatic) get_target_property(config ${target} CONFIG) get_target_property(arch ${target} ARCH) get_target_property(ninjaTarget ${target} NINJA_TARGET) @@ -493,13 +504,15 @@ function(add_rsp_command target buildDir completeStatic) ) endfunction() -function(add_ios_rsp_command target buildDir completeStatic) +function(add_intermediate_object target buildDir completeStatic) get_target_property(config ${target} CONFIG) get_target_property(arch ${target} ARCH) get_target_property(ninjaTarget ${target} NINJA_TARGET) get_target_property(cmakeTarget ${target} CMAKE_TARGET) string(TOUPPER ${config} cfg) - get_ios_target_triple_and_sysroot(args ${arch}) + if(IOS) + get_ios_target_triple_and_sysroot(args ${arch}) + endif() set(objects_rsp "${buildDir}/${ninjaTarget}_objects.rsp") set(objects_out "${buildDir}/${cmakeTarget}_objects.o") add_custom_command( @@ -1081,11 +1094,17 @@ function(add_gn_build_aritfacts_to_target cmakeTarget ninjaTarget module buildDi LINK_DEPENDS ${buildDir}/${config}/${arch}/${ninjaTarget}.stamp ) if(QT_IS_MACOS_UNIVERSAL) - add_rsp_command(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + add_intermediate_archive(${target} ${buildDir}/${config}/${arch} ${completeStatic}) elseif(IOS) - add_ios_rsp_command(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + add_intermediate_object(${target} ${buildDir}/${config}/${arch} ${completeStatic}) else() - extend_cmake_target(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + if(MACOS AND QT_FEATURE_static) + # mac archiver does not support @file notation, do intermediate object istead + add_intermediate_object(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + add_archiver_options(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + else() + add_linker_options(${target} ${buildDir}/${config}/${arch} ${completeStatic}) + endif() endif() unset(target) endforeach() |