PUBLIC_HEADER target property ignored when building Mac OS Frameworks

CMake version: 3.21.2
OS: macOS Monterey 12.4

I am trying to build a MacOS framework using CMake and would like to copy the lib’s public headers into a Headers subfolder inside the framework. According to CMake documentations, all I need to do is to set the PUBLIC_HEADER target property. Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.21)
project(hello)

set(CMAKE_CXX_STANDARD 17)
add_library(hello SHARED src/hello.cpp)
target_include_directories(hello PRIVATE include)

set_target_properties(hello PROPERTIES
    FRAMEWORK True
    MACOSX_FRAMEWORK_IDENTIFIER com.cmake.helloFramework
    VERSION 16.4.0
    SOVERSION 1.0.0
    PUBLIC_HEADER include/hello.h
    XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)

install(
    TARGETS hello
    FRAMEWORK 
        DESTINATION lib
)
     

And here is how I configure, built, and installed my project:

mkdir build && cd build
cmake -G "Xcode" -DCMAKE_INSTALL_PREFIX=../install ..
cmake --build . --target install

Here is the output I get:

-- Install configuration: "Debug"
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Resources
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions/Current
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions/16.4.0
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions/16.4.0/Resources
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions/16.4.0/Resources/Info.plist
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/Versions/16.4.0/hello
-- Installing: /Users/user_name/Desktop/public_header_test/install/lib/hello.framework/hello

The header include/hello.h does not get installed inside hello.framework at all, despite the CMake documentation explicitly stating that PUBLIC_HEADER should work for frameworks. Am I doing or understanding something incorrectly here?

Change this to:

add_library(hello SHARED src/hello.cpp include/hello.h)

The framework’s public headers have to be source files of the framework’s target.