Replies: 28 comments
-
Note: as a workaround, I'm currently doing the following in my CMakeLists (finding and parsing freetype.h), which is a little bit convoluted:
|
Beta Was this translation helpful? Give feedback.
-
Because freetype doesn't provide its version. |
Beta Was this translation helpful? Give feedback.
-
What do you mean exactly by "freetype doesn't provide its version"? The version is in the freetype.h header, and the FindFreetype module built-in CMake provides a FREETYPE_VERSION. So I think the freetype-config.cmake file provided by vcpkg (and any other config file provided by vcpkg) should also provide an easy way to get its version: it's quite an important information to display in the CMake output, or check against. |
Beta Was this translation helpful? Give feedback.
-
@dalboris That is provided by cmake instead of freetype. And Thanks. |
Beta Was this translation helpful? Give feedback.
-
@JackBoosY I still don't understand what you mean by "That is provided by cmake instead of freetype". In my book, freetype does provide a version, and the built-in FindFreetype module of CMake just reads it. Here is content from
The issue is specifically with vcpkg: outside of vcpkg's world, most FindFoobar modules provide a version. But with vcpkg, it seems that its foobar-config.cmake modules don't do it, such as I show here with the freetype-config.cmake module of vcpkg. So my question is: do the vcpks CMake modules really don't provide a version as CMake variable for the found library? It would seem like a huge oversight: I really expect to be able to do |
Beta Was this translation helpful? Give feedback.
-
Note in case this was unclear: I want to have access to |
Beta Was this translation helpful? Give feedback.
-
FindFreetype.cmake -> https://github.com/Kitware/CMake/blob/master/Modules/FindFreetype.cmake
Usually, when using |
Beta Was this translation helpful? Give feedback.
-
Example: |
Beta Was this translation helpful? Give feedback.
-
Oh, I see! So you're saying that the freetype-config.cmake file provided by vcpkg isn't actually generated/designed by vcpkg, but comes from freetype? (Question 1) More specifically, are you saying that in freetype-2.10.2/CMakeLists.txt#L546, if instead of:
There was:
Then there would auto-magically be a And you're saying that some (or most?) other foobar-config.cmake provided by vcpkg do expose such Anyway, this does mean that Kitware's built-in FindFreeType module is superior than the freetype-config.cmake module provided by vcpkg, regardless of whether this freetype-config.cmake is designed by FreeType itself or by vcpkg. I'd say that if such write_basic_package_version_file() function is missing upstream, it should the role of the package manager to fill the hole: the package manager does know the installed version, and should provide easy ways to access it in CMake. In fact, version management is the primary role of a package manager. At the contrary, it isn't the responsibility of a library (such as FreeType) to provide config files for every build system in existence, although in the specific case of CMake, I would agree it's probably a shared responsibility, since it is nowadays a de-facto standard. |
Beta Was this translation helpful? Give feedback.
-
FYI: I reported this upstream: https://savannah.nongnu.org/bugs/index.php?58935
|
Beta Was this translation helpful? Give feedback.
-
I actually realized that even when FreeType is installed via vcpkg, we can simply do
I noticed this because I had the following message in my CI builds, which apparently have a different version of vcpkg (older?):
This message seems to have been removed on Jan 2020 (#9311) in favor of the more generic So it isn't really clear to me what's the cleanest approach, but I'm now using |
Beta Was this translation helpful? Give feedback.
-
For questions:
|
Beta Was this translation helpful? Give feedback.
-
Since freetype's CMakelists.txt is maintained by its official, we believe that the cmake files generated by itself are more reasonable and stable than using FindFreetype.cmake. This is why FindFreetype.cmake is deprecated. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your patience and answering my questions, everything seems clear now. |
Beta Was this translation helpful? Give feedback.
-
I am trying to write a patch upstream for FreeType, using write_basic_package_version_file(). Does vcpkg care where is the freetype-config-version.cmake file generated? When I run
And if I add the following to the freetype2\CMakeLists.txt:
Then running cmake again generates the following file:
However, note that it is not located under Should I get rid of the
Or should I find a way to generate it in Thank you! |
Beta Was this translation helpful? Give feedback.
-
Just adding a link to this helpful resource, for anyone reading this thread and as confused as I was about *-config-version.cmake: https://cliutils.gitlab.io/modern-cmake/chapters/install/installing.html |
Beta Was this translation helpful? Give feedback.
-
@dalboris Just install it to |
Beta Was this translation helpful? Give feedback.
-
@JackBoosY I can't find mention of Sorry for all these perhaps obvious questions, I'm new to all this. |
Beta Was this translation helpful? Give feedback.
-
@dalboris Sorry for late, I completely forgot this issue. # vcpkg config install path
option(CONFIG_INSTALL_PATH "location to install cmake config files" lib/cmake/freetype) |
Beta Was this translation helpful? Give feedback.
-
Thanks @JackBoosY, this is useful, I'm now working on a FreeType patch. No worry about the delay, I was busy with other things anyway. First notes:
|
Beta Was this translation helpful? Give feedback.
-
@JackBoosY Oh, I actually just realized that by:
You were not saying "add this to the CMakeLists.txt". You were in fact referring to an already existing line that comes from vcpkg's https://github.com/microsoft/vcpkg/pull/11846/files This is confusing. Just to clarify, when I said "I'm working on a patch" in the last message, I meant I'm modifying the source CMakeLists.txt found in FreeType git's repository, and submitting the changes directly to FreeType folks. I wasn't taking about a ".patch" file in the vcpkg's port. In fact, I do not quite understand the reason why #11846 introduced this CONFIG_INSTALL_PATH. Perhaps @kevinlul could clarify: was |
Beta Was this translation helpful? Give feedback.
-
OK, so I'm planning to submit to FreeType folks a change which modifies this:
into this:
This successfuly creates a Note that I'm using |
Beta Was this translation helpful? Give feedback.
-
@dalboris Oh sorry, I didn't view the history before. After check that PR, I think we may not use |
Beta Was this translation helpful? Give feedback.
-
You need to install |
Beta Was this translation helpful? Give feedback.
-
@JackBoosY Perfect, indeed
Let me know if you'd also like to apply this patch in the vcpkg port, while we wait for the patch to be merged upstream and a new version of FreeType to be released. |
Beta Was this translation helpful? Give feedback.
-
@dalboris we need to wait for upstream merge that changes. |
Beta Was this translation helpful? Give feedback.
-
@JackBoosY Thanks, waiting for upstream then. I've just sent them a reminder about this patch. |
Beta Was this translation helpful? Give feedback.
-
Follow-up: the change is now merged upstream, so it should be available in the next version of FreeType. |
Beta Was this translation helpful? Give feedback.
-
Without using vcpkg, I usually have access library version in my CMakeLists, like so:
But, when using vcpkg, this doesn't seem to work. Here is an example with FreeType:
Output:
Is there any way to get those versions for packages installed and found with vcpkg?
Beta Was this translation helpful? Give feedback.
All reactions