find_library misses a framework

I don’t quite understand why find_library fails locate a framework when cross-compiling for tvOS:

CMake Debug Log at qtmultimedia/cmake/FindFFmpeg.cmake:128 (find_library):
  find_library called with the following settings:

    VAR: AVDEVICE_LIBRARY
    NAMES: "avdevice"
    Documentation: Path to a library.
    Framework
      Only Search Frameworks: 0
      Search Frameworks Last: 0
      Search Frameworks First: 1
    AppBundle
      Only Search AppBundle: 0
      Search AppBundle Last: 0
      Search AppBundle First: 1
    CMAKE_FIND_USE_CMAKE_PATH: 1
    CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
    CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
    CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
    CMAKE_FIND_USE_INSTALL_PREFIX: 1

  find_library considered the following locations:

    /Users/developer/Documents/Qt-build/install/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/install/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/install/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/install/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/install/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/usr/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/System/Library/Frameworks/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Applications/Xcode-15.1.0.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator17.2.sdk/System/Library/Frameworks/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)
    /usr/local/(lib)avdevice(\.tbd|\.dylib|\.so|\.a)

  The item was not found.

The library is bundled in a framework and available at /Users/developer/Documents/Qt-build/install/lib/libavdevice.framework/libavdevice. But this path was not even considered, as you can see from the output above.

At the same time find_path has no problem with it:

CMake Debug Log at qtmultimedia/cmake/FindFFmpeg.cmake:117 (find_path):
  find_path called with the following settings:

    VAR: AVDEVICE_INCLUDE_DIRS
    NAMES: "libavdevice/avdevice.h"
    Documentation: Path to a file.
    Framework
      Only Search Frameworks: 0
      Search Frameworks Last: 0
      Search Frameworks First: 1
    AppBundle
      Only Search AppBundle: 0
      Search AppBundle Last: 0
      Search AppBundle First: 1
    CMAKE_FIND_USE_CMAKE_PATH: 1
    CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
    CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
    CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
    CMAKE_FIND_USE_INSTALL_PREFIX: 1

  find_path considered the following locations:

    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/include/ffmpeg/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/include/include/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/include/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/ffmpeg/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/include/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/Users/developer/Documents/Qt-build/Qt-appletvsimulator/src/Qt-build/qtbase/lib/cmake/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/lib/ffmpeg/libavdevice.framework/Headers/avdevice.h
    /Users/developer/Documents/Qt-build/install/lib/include/libavdevice.framework/Headers/avdevice.h

  The item was found at

    /Users/developer/Documents/Qt-build/install/lib/libavdevice.framework/Headers/avdevice.h

Is there a configuration variable or find_library setting that may prevent it from looking for frameworks?

CMAKE_FIND_FRAMEWORK is probably what you’re looking for. It’s not all that common to see anything set that though.

find_library can properly locate frameworks. It’s just output of --debug-find fails to mention framework locations. See https://gitlab.kitware.com/cmake/cmake/-/issues/25547