[cmake-developers] FindFreetype Maintenance

Greg Jung gvjung at gmail.com
Fri May 23 00:56:45 EDT 2014


In my case, Mingw/MSYS, I'm on a windows platform with "unix-like"
directory tree.  I solved the missing freetype
by creating a sensible CMAKE_SYSTEM_PREFIX_PATH at the outset; this is
unfortunately set under windows (WIN32) to a set of paths which should be
called CMAKE_SYSTEM_PROGRAM_PATH.  The only modules to use this was
FindMPI.
I believe this isn't really correct because gcc should be free to compile
without /usr/include or /usr/local/include in the include paths.

 For my usage,  I found that cmake will convert possibly one of the paths
in the xxFLAGS but not the second or third, and
if options follow even the first path isn't translated.  This behavior is
buried in however $ENV{VAR} is handled.
 i.e.
CFLAGS= -I/usr/local/include -I/usr/include will become, under set(
variable $ENV{CFLAGS}),
variable = "-ID:/mingw/msys/1.0/local/include -I/usr/include"
  and also if
CFLAGS='-I/usr/local/include -mthreads -morestuff' then $ENV{CFLAGS} will
simply stay as it is.

  Somehow $ENV{CFLAGS} impossibly translates the first group but fails to
go beyond that first blank.

 Including /usr and /usr/local in the .cmake file's search would solve the
unix problem.
It doesn't make sense to me to chase every different freetype install
location.  It does make sense to reform
the original kludge, which finds ft2build.h (should be easy) then goes
after config/ftheader.h; ft2build simply
includes (???)/config/ftheader.h  in whatever the way it would show.
A simple search for freetype as a library, then verifying the affiliated
include directory for ft2build.h,
should replace the gymnastics there now.

On Wed, May 21, 2014 at 11:44 PM, Taylor Holberton <
taylorcholberton at gmail.com> wrote:

> I'm suggesting that the search paths /usr and /usr/local be included in
> the search paths, and /program files (x86)/freetype for Windows.
>
> It looks like it currently only searches X11 directories, which doesn't
> work for instances that freetype is installed from its git repo.
>
> Does it make sense to do this?
>  On May 21, 2014 11:31 PM, "Greg Jung" <gvjung at gmail.com> wrote:
>
>> On Wed, May 21, 2014 at 6:50 PM, Taylor Holberton <
>> taylorcholberton at gmail.com> wrote:
>>
>>> I've noticed that the FindFreetype module doesn't search standard Unix
>>> and Windows paths. Can I add these to the find module?
>>>
>>> As it currently stands, the module won't find Freetype in either Windows
>>> or Linux (despite it being installed in very standard locations). It can be
>>> overridden by creating an environment variable called FREETYPE_DIR, but I
>>> think adding a search to standard installation paths would be preferable
>>> for most.
>>>
>> Freetype include files have been found in the wild under
>>  include/freetype2/config (My recent mingw installation) and also
>> include/freetype2/freetype/config;
>> In the first case, current cmake Findfreetype won't ever be satisfied
>> because it wants
>> to find  "freetype/config/ftheader.h"
>> I think it gets built these days with the second form, with ft2build.h in
>> include/ and ftheader.h
>> under config - ft2build simply includes ftheader relative to itself.
>>  cmake looks for both files in the second case; it needs to find both
>> (even if you may not be referencing them in code).
>> If you are built that way you should be good (under unix only; see code
>> below), FREETYPE_DIR would help if you have re-located it.
>> I (just) found that the variable CMAKE_SYSTEM_PREFIX_PATH can be used to
>> guide the search;  also CMAKE_PREFIX_PATH as the documentation says.  It
>> worked for me when I set this variable under MSYS generator.
>> You can also use CMAKE_SYSTEM_INCLUDE_PATH and CMAKE_INCLUDE_PATH as
>> environment variables.
>>
>> find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
>>   HINTS
>>     ENV FREETYPE_DIR
>>   PATHS
>>     /usr/X11R6
>>     /usr/local/X11R6
>>     /usr/local/X11
>>     /usr/freeware
>>     ENV GTKMM_BASEPATH
>>     [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
>>     [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
>>   PATH_SUFFIXES include/freetype2 include
>> )
>>
>> find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
>>   HINTS
>>     ENV FREETYPE_DIR
>>
>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140522/e212c7fc/attachment-0002.html>


More information about the cmake-developers mailing list