Skip to content

freetype package causes error with CMake 3.28 #732

@zerotacg

Description

@zerotacg

Hi,
starting with CMake 3.28.0 the usage of freetype config was added in FindFreetype.cmake which reads the config of the hunter package.
After that FindFreetype.cmake tries to read some properties of the freetype target
And this results in an error 🤕

CMake Error at /opt/cmake/share/cmake-3.28/Modules/FindFreetype.cmake:108 (get_property):
  get_property could not find TARGET freetype.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:12 (find_package)

The freetype library seems to provide both targets (see here and here)
while the hunter package seems to only provides freetype::freetype and Freetype::Freetype (ccp-pm/freetype) and not the freetype target.

I also provided a small project that demonstrates the issue.

My CMake knowledge is quite limited so I'm uncertain what the correct solution to this issue is. That is why I seek your help to find an appropriate soluion.

thx 😺


https://github.com/Kitware/CMake/blob/v3.28.1/Modules/FindFreetype.cmake#L100
https://github.com/Kitware/CMake/blob/v3.28.1/Modules/FindFreetype.cmake#L108

https://gitlab.freedesktop.org/freetype/freetype/-/issues/1165
https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/178

https://github.com/cpp-pm/freetype/blob/hunter-2.10.4/cmake/template/Config.cmake.in

https://github.com/zerotacg/hunter-freetype-issue/tree/main
https://github.com/zerotacg/hunter-freetype-issue/actions/runs/7309580812/job/19917318519#step:3:1177

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions