On 6/5/2016 4:26 AM, Rolf Eike Beer wrote:
Am Samstag, 4. Juni 2016, 19:26:22 schrieb Stuart Mentzer:
On 6/4/2016 5:03 PM, Roger Leigh wrote:
On 04/06/2016 20:47, Stuart Mentzer wrote:
Hello,
FindFreetype.cmake is failing to find the debug library on Windows
because it is named freetype*d*.lib and freetyped isn't in the NAMES
list. Is there some variable I can set to get it found or can freetyped
get added to NAMES?
See how other modules handle this, e.g.
https://github.com/Kitware/CMake/blob/master/Modules/FindZLIB.cmake#L77
Note the separate searches for the release and debug libs on lines 88-89
and select_library_configurations on line 93.
If you adapt FindFreetype to use the same pattern, it will handle this
properly.
Thanks Roger. That looks the right way to do it. Seems odd that it is
handled for zlib but not for freetype. Is this something we can just ask
the developers to fix or would it be best for me to submit the fix to the
developers list?
It's a reasonable addition, so if you can't come up with a patch yourself I'll
have a look if I can do one next week which you can test.
Greetings,
Eike
Eike,
Here is my patched FindFreetype.cmake that should find the freetyped debug
library on Windows. I hope that helps. If you know what version of CMake will
get this update that would be great to know.
Thanks,
Stuart
#.rst:
# FindFreetype
# ------------
#
# Locate FreeType library
#
# This module defines
#
# ::
#
# FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
# This is the concatenation of the paths:
# FREETYPE_INCLUDE_DIR_ft2build
# FREETYPE_INCLUDE_DIR_freetype2
#
#
#
# $FREETYPE_DIR is an environment variable that would correspond to the
# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
# This file has been renamed to "FindFreetype.cmake" instead of the correct
# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
# Ugh, FreeType seems to use some #include trickery which
# makes this harder than it should be. It looks like they
# put ft2build.h in a common/easier-to-find location which
# then contains a #include to a more specific header in a
# more specific location (#include <freetype/config/ftheader.h>).
# Then from there, they need to set a bunch of #define's
# so you can do something like:
# #include FT_FREETYPE_H
# Unfortunately, using CMake's mechanisms like include_directories()
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
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
freetype2
)
find_path(
FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.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
freetype2
)
set(FREETYPE_NAMES_RELEASE freetype libfreetype freetype219)
set(FREETYPE_NAMES_DEBUG freetyped libfreetyped freetype219d)
find_library(FREETYPE_LIBRARY_RELEASE
NAMES
${FREETYPE_NAMES_RELEASE}
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
lib
)
find_library(FREETYPE_LIBRARY_DEBUG
NAMES
${FREETYPE_NAMES_DEBUG}
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
lib
)
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS
"${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING
"${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
Freetype
REQUIRED_VARS
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIRS
VERSION_VAR
FREETYPE_VERSION_STRING
)
mark_as_advanced(
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake