target_link_libraries doesn't respect XCODE_ATTRIBUTE_PRODUCT_NAME attribute
Hi,
When I specify a framework name with XCODE_ATTRIBUTE_PRODUCT_NAME
and link this target to another framework I have a compilation error. Example script:
cmake_minimum_required(VERSION 3.12)
project(test)
enable_language(Swift)
add_library(ModuleFoo SHARED "${CMAKE_CURRENT_LIST_DIR}/swift/foo.swift")
set_target_properties(ModuleFoo PROPERTIES
FRAMEWORK TRUE
XCODE_ATTRIBUTE_DEFINES_MODULE YES
XCODE_ATTRIBUTE_PRODUCT_NAME CustomName)
add_library(ModuleBar SHARED "${CMAKE_CURRENT_LIST_DIR}/swift/bar.swift")
set_target_properties(ModuleBar PROPERTIES
FRAMEWORK TRUE)
target_link_libraries(ModuleBar PRIVATE ModuleFoo)
Leads to compilation error:
Ld /balhblah/bug-cmake/build/Debug/ModuleBar.framework/Versions/A/ModuleBar normal (in target 'ModuleBar' from project 'test')
cd /balhblah/bug-cmake
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-macos10.15 ... -framework ModuleFoo
ld: framework not found ModuleFoo
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Obviously target_link_libraries
doesn't respect XCODE_ATTRIBUTE_PRODUCT_NAME
property.
The issue is common for MacOS and iOS.
Test project is attached: Archive.zip
The command to reproduce:
cmake -GXcode .. && cmake --build .