Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freetype package causes error with CMake 3.28 #732

Open
zerotacg opened this issue Dec 23, 2023 · 2 comments
Open

freetype package causes error with CMake 3.28 #732

zerotacg opened this issue Dec 23, 2023 · 2 comments

Comments

@zerotacg
Copy link

zerotacg commented Dec 23, 2023


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

@NeroBurner
Copy link

Just at a glance. Could it be that the hunter packages version of free type is too old and doesn't yet provide both CMake targets?

@zerotacg
Copy link
Author

From what I can tell with version 2.10.4, same as hunter, the freetype library did use the freetype target [0] and only later added the Freetype::Freetype alias.

[0] https://gitlab.freedesktop.org/freetype/freetype/-/blob/VER-2-10-4/CMakeLists.txt?ref_type=tags#L384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants