Can't find headers in framework when using Config

On macOS, I get the following error when I try to build a project that uses find_package to load MyLibConfig.cmake :

/Users/vdamewood/tmp/projekto/MyConsumer/src/main.c:1:10: fatal error: 'MyLib/MyLib.h' file not found
#include <MyLib/MyLib.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/MyConsumer.dir/src/main.c.o] Error 1
make[1]: *** [CMakeFiles/MyConsumer.dir/all] Error 2
make: *** [all] Error 2

I have two projects in subdirectories of ~/tmp/Projekto named MyLib and MyConsumer. This error occurs when running make when building MyConsumer. This is how I built MyLib:

mkdir ~/tmp/Projekto/build-MyLib
cd ~/tmp/Projekto/build-MyLib
cmake ../MyLib
make
DESTDIR=./install make install

Then I built MyConsumer with this:

mkdir ~/tmp/Projekto/build-MyConsumer
cd ~/tmp/Projekto/build-MyConsumer
CMAKE_PREFIX_PATH=../build-MyLib/install/usr/local cmake ../MyConsumer
make

MyLib/CMakeLists.txt contains this:

cmake_minimum_required(VERSION 3.14)
project(MyLib
	VERSION       1.2.0
	LANGUAGES     C
)

add_library(MyLib)
set(PUBLIC_HEADERS
	include/MyLib/MyLib.h
	${CMAKE_CURRENT_BINARY_DIR}/include/MyLib/Api.h
)

target_sources(MyLib
	PRIVATE
		src/MyLib.c
		${PUBLIC_HEADERS}
)

target_include_directories(MyLib
	PUBLIC
		"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
		"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
)
if (APPLE)
	# FIXME: framework path
else()
	target_include_directories(MyLib
		INTERFACE
			"$<INSTALL_INTERFACE:include>"
	)
endif()

set_target_properties(MyLib PROPERTIES
	PUBLIC_HEADER             "${PUBLIC_HEADERS}"
	C_VISIBILITY_PRESET       hidden
	VISIBILITY_INLINES_HIDDEN On
	FRAMEWORK                 TRUE
	FRAMEWORK_VERSION         ${PROJECT_VERSION}
	VERSION                   ${PROJECT_VERSION}
	SOVERSION                 ${PROJECT_VERSION_MAJOR}
)

include(GenerateExportHeader)
generate_export_header(MyLib
	EXPORT_FILE_NAME include/MyLib/Api.h
	EXPORT_MACRO_NAME MYLIB_API
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
	MyLibConfigVersion.cmake
	VERSION ${MyLib_VERSION}
	COMPATIBILITY SameMajorVersion
)

include(GNUInstallDirs)
install(TARGETS MyLib EXPORT MyLib
	RUNTIME       DESTINATION ${CMAKE_INSTALL_BINDIR}
	ARCHIVE       DESTINATION ${CMAKE_INSTALL_LIBDIR}
	LIBRARY       DESTINATION ${CMAKE_INSTALL_LIBDIR}
	FRAMEWORK     DESTINATION .
	RESOURCE      DESTINATION ${CMAKE_INSTALL_DATADIR}/MyLib
	PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/MyLib
)

if(APPLE)
	set(CONFIG_DESTINATION MyLib.framework/Resources)
else()
	set(CONFIG_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/MyLib)
endif()

install(EXPORT MyLib
      DESTINATION ${CONFIG_DESTINATION}
      NAMESPACE MyLib::
      FILE MyLibConfig.cmake
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MyLibConfigVersion.cmake
	DESTINATION ${CONFIG_DESTINATION}
)

MyConsumer/CMakeLists.txt contains this:

cmake_minimum_required(VERSION 3.14)
project(MyConsumer
        VERSION 1.0.0
        LANGUAGES C
)

find_package(MyLib 1.1.0 REQUIRED)
message("MyLib_FOUND ${Siliko_FOUND}")
add_executable(MyConsumer)
target_sources(MyConsumer PUBLIC src/main.c)
target_link_libraries(MyConsumer PRIVATE MyLib::MyLib)

I tried building MyConsumer manually and found that the the difference between getting this error and not was whether or not I used -F ../build-MyLib/install/usr/local. So, I tried adding this to the generated MyLibConfig.cmake file:

set_target_properties(MyLib::MyLib PROPERTIES
  INTERFACE_COMPILE_OPTIONS "-F${_IMPORT_PREFIX}"
)

With this addition, MyConsumer builds, links, and runs without a problem.

Is there some way I can get CMake to generate MyLibConfig.cmake with this, or somehow get clang to look for the framework at compile time in the directory where it was found?

If it matters, here’s the generated MyLibConfig.cmake file without modification:

# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6...3.19)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget MyLib::MyLib)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  unset(_targetsDefined)
  unset(_targetsNotDefined)
  unset(_expectedTargets)
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target MyLib::MyLib
add_library(MyLib::MyLib STATIC IMPORTED)
set_property(TARGET MyLib::MyLib PROPERTY FRAMEWORK 1)

# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/MyLibConfig-*.cmake")
foreach(f ${CONFIG_FILES})
  include(${f})
endforeach()

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
  foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
    if(NOT EXISTS "${file}" )
      message(FATAL_ERROR "The imported target \"${target}\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)