[CMake] FindFreetype works with MinGW but not Visual Studio?

Nicholas Braden nicholas11braden at gmail.com
Thu Jul 21 06:15:51 EDT 2016


I'm having a weird issue that is driving me crazy. I've attached a
minimal test case - it downloads and builds Freetype 2.6.4 as static
and then configures a project that just calls find_package(Freetype
REQUIRED). If the attachment is not there, you can find the two text
files here:
https://gist.github.com/LB--/34d9dd2d9888fa4479bc9ef61183502c
Save "my-project-CMakeLists.txt" as "CMakeLists.txt" in a "my-project"
directory next to the other CMakeLists.txt

When I build with MinGW (cmake -G "MinGW Makefiles") everything works
smoothly and the find_package command works flawlessly.

However, when I build with Visual Studio (cmake -G "Visual Studio 14
2015 Win64") I get this error message:
Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version "2.6.4")

Looking in the install prefix, in the lib folder MinGW has a
"libfreetype.a" and MSVC has a "freetyped.lib". Both should be
acceptable according to the source code of the FindFreetype module:
https://github.com/Kitware/CMake/blob/v3.6.0/Modules/FindFreetype.cmake

Here are my build logs:
MinGW: https://gist.github.com/LB--/b4f1413ba72181de7710b6f916c399f8
MSVC: https://gist.github.com/LB--/14a2f65dd069aa59c2a5dacd840f3535

I'm using CMake 3.6.0, MinGW-w64 GCC 6.1.0, and Visual Studio 2015
Update 3 - all on a Windows 10 Pro 64-bit system (build 10586.494).

Does anyone know what is causing this? Why can't the find module
discover the library archive when building with Visual Studio?

For now I have been working around the issue by manually specifying
FREETYPE_LIBRARY, which works, but is not desireable.

Thanks for your time,
Nicholas "LB" Braden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find-freetype.zip
Type: application/zip
Size: 987 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160721/aec6d779/attachment.zip>


More information about the CMake mailing list