Commits

Takeshi Abe committed e204de5

import FindFontConfig.cmake

from <http://freetype-gl.googlecode.com/svn-history/r110/trunk/CMakeModules/FindFontConfig.cmake>;

This replaces old FindFontconfig.cmake using obsolete UsePkgConfig.

Comments (0)

Files changed (4)

 
 	include(AC_HEADER_STDC)
 	include(CheckPrototypeExists)
-	SET(FONTCONFIG_FIND_QUIETLY, 1)
 
 	message(STATUS "PNG Support: ${ENABLE_PNG}")
 
 	endif (ENABLE_XPM)
 
 	if (ENABLE_FONTCONFIG)
-		FIND_PACKAGE(Fontconfig)
+		FIND_PACKAGE(FontConfig)
 	endif (ENABLE_FONTCONFIG)
 
 	if (FREETYPE_FOUND)
 		INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
 		SET(HAVE_LIBFONTCONFIG 1)
 	ELSE (FONTCONFIG_FOUND)
-		SET(FONTCONFIG_LIBRARIES "")
+		SET(FONTCONFIG_LIBRARY "")
 		SET(FONTCONFIG_INCLUDE_DIR "")
 		SET(FONTCONFIG_LIB_DIR "")
 	ENDIF(FONTCONFIG_FOUND)

cmake/modules/FindFontConfig.cmake

+# - Try to find Fontconfig
+# Once done this will define
+#
+#  FONTCONFIG_FOUND - system has Fontconfig
+#  FONTCONFIG_INCLUDE_DIR - the Fontconfig include directory
+#  FONTCONFIG_LIBRARY - Link these to use Fontconfig
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
+   # in cache already
+   SET(Fontconfig_FIND_QUIETLY TRUE)
+endif ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+if( NOT WIN32 )
+  find_package(PkgConfig)
+
+  pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig)
+endif( NOT WIN32 )
+
+FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
+  PATHS
+    /usr/local/include
+    /usr/X11/include
+    /usr/include
+  HINTS
+    ${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config
+)
+
+FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
+  PATHS
+    /usr/local
+    /usr/X11
+    /usr
+  HINTS
+    ${FONTCONFIG_PKG_LIBRARY_DIRS} # Generated by pkg-config
+  PATH_SUFFIXES
+    lib64
+    lib
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR )
+
+# show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view
+MARK_AS_ADVANCED(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY )

cmake/modules/FindFontconfig.cmake

-# - Try to find the  Fontconfig
-# Once done this will define
-#
-#  FONTCONFIG_FOUND - system has Fontconfig
-#  FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
-#  FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
-#  FONTCONFIG_INCLUDE_DIR - FontConfig include dir
-# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-if (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)
-
-  # in cache already
-  set(FONTCONFIG_FOUND TRUE)
-
-else (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)
-IF (NOT WIN32)
-  # use pkg-config to get the directories and then use these values
-  # in the FIND_PATH() and FIND_LIBRARY() calls
-  INCLUDE(UsePkgConfig)
-
-  PKGCONFIG(fontconfig _FONTCONFIGIncDir _FONTCONFIGLinkDir _FONTCONFIGLinkFlags _FONTCONFIGCflags)
-
-  set(FONTCONFIG_DEFINITIONS ${_FONTCONFIGCflags} CACHE INTERNAL "The compilation flags for fontconfig")
-ENDIF (NOT WIN32)
-  find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
-    PATHS
-    ${_FONTCONFIGIncDir}
-    /usr/include
-    /usr/local/include
-    /usr/X11/include
-  )
-
-  find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
-    PATHS
-    ${_FONTCONFIGLinkDir}
-	/usr/lib64
-    /usr/lib
-    /usr/local/lib
-  )
-
-  if (FONTCONFIG_LIBRARIES)
-     set(FONTCONFIG_FOUND TRUE)
-  endif (FONTCONFIG_LIBRARIES)
-
-  if (FONTCONFIG_FOUND)
-    if (NOT FONTCONFIG_FIND_QUIETLY)
-      message(STATUS "Found FONTCONFIG: ${FONTCONFIG_LIBRARIES}")
-    endif (NOT FONTCONFIG_FIND_QUIETLY)
-  else (FONTCONFIG_FOUND)
-    if (FONTCONFIG_FIND_REQUIRED)
-      message(FATAL_ERROR "Could NOT find FONTCONFIG")
-    endif (FONTCONFIG_FIND_REQUIRED)
-  endif (FONTCONFIG_FOUND)
-
-  MARK_AS_ADVANCED(FONTCONFIG_LIBRARIES)
-
-endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)

src/CMakeLists.txt

 
 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/  ${GD_SOURCE_DIR}/src)
 
-target_link_libraries(${GD_LIB} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES})
-target_link_libraries(${GD_LIB_STATIC} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARIES})
+target_link_libraries(${GD_LIB} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY})
+target_link_libraries(${GD_LIB_STATIC} ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARIES} ${XPM_LIBRARIES} ${FONTCONFIG_LIBRARY})
 
 set(GD_PROGRAMS annotate gdparttopng gdtopng gd2copypal gd2topng pngtogd pngtogd2 webpng gd2togif gdcmpgif giftogd2)
 foreach(program ${GD_PROGRAMS})