aboutsummaryrefslogtreecommitdiff
path: root/CMake/FindGdkPixbuf.cmake
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-12-11 14:07:08 -0500
committerGitHub <noreply@github.com>2016-12-11 14:07:08 -0500
commit6350752d6be2abfac68aa16e891dd859aa5cdafa (patch)
tree18c24336e664111ba9c3a5bfedec5c340ec0a19d /CMake/FindGdkPixbuf.cmake
parentd93e53fd4b57c478097aee899da8226acfe3d318 (diff)
parentda26d69cb1b21d582a81af0cad7342fab6596eed (diff)
Merge pull request #985 from myfreeweb/master
Fix build on FreeBSD
Diffstat (limited to 'CMake/FindGdkPixbuf.cmake')
-rw-r--r--CMake/FindGdkPixbuf.cmake65
1 files changed, 29 insertions, 36 deletions
diff --git a/CMake/FindGdkPixbuf.cmake b/CMake/FindGdkPixbuf.cmake
index 4ea1d5b9..9cad4f92 100644
--- a/CMake/FindGdkPixbuf.cmake
+++ b/CMake/FindGdkPixbuf.cmake
@@ -8,43 +8,36 @@
# Define GDK_PIXBUF_MIN_VERSION for which version desired.
#
-INCLUDE(FindPkgConfig)
+find_package(PkgConfig)
-IF(GdkPixbuf_FIND_REQUIRED)
- SET(_pkgconfig_REQUIRED "REQUIRED")
-ELSE(GdkPixbuf_FIND_REQUIRED)
- SET(_pkgconfig_REQUIRED "")
-ENDIF(GdkPixbuf_FIND_REQUIRED)
+if(GdkPixbuf_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "REQUIRED")
+else(GdkPixbuf_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "")
+endif(GdkPixbuf_FIND_REQUIRED)
-IF(GDK_PIXBUF_MIN_VERSION)
- PKG_SEARCH_MODULE(GDK_PIXBUF ${_pkgconfig_REQUIRED} "gdk-pixbuf-2.0>=${GDK_PIXBUF_MIN_VERSION}")
-ELSE(GDK_PIXBUF_MIN_VERSION)
- PKG_SEARCH_MODULE(GDK_PIXBUF ${_pkgconfig_REQUIRED} "gdk-pixbuf-2.0")
-ENDIF(GDK_PIXBUF_MIN_VERSION)
+if(GDK_PIXBUF_MIN_VERSION)
+ pkg_check_modules(GDK_PIXBUF ${_pkgconfig_REQUIRED} "gdk-pixbuf-2.0>=${GDK_PIXBUF_MIN_VERSION}")
+else(GDK_PIXBUF_MIN_VERSION)
+ pkg_check_modules(GDK_PIXBUF ${_pkgconfig_REQUIRED} "gdk-pixbuf-2.0")
+endif(GDK_PIXBUF_MIN_VERSION)
-IF(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
- FIND_PATH(GDK_PIXBUF_INCLUDE_DIRS gdk-pixbuf/gdk-pixbuf.h)
- FIND_LIBRARY(GDK_PIXBUF_LIBRARIES gdk_pixbuf-2.0)
+if(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
+ find_path(GDK_PIXBUF_INCLUDE_DIRS gdk-pixbuf/gdk-pixbuf.h)
+ find_library(GDK_PIXBUF_LIBRARIES gdk_pixbuf-2.0)
+else(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
+ SET(GdkPixbuf_FOUND 1)
+ # Make paths absolute https://stackoverflow.com/a/35476270
+ # Important on FreeBSD because /usr/local/lib is not on /usr/bin/ld's default path
+ set(GDK_PIXBUF_LIBS_ABSOLUTE)
+ foreach(lib ${GDK_PIXBUF_LIBRARIES})
+ set(var_name GDK_PIXBUF_${lib}_ABS)
+ find_library(${var_name} ${lib} ${GDK_PIXBUF_LIBRARY_DIRS})
+ list(APPEND GDK_PIXBUF_LIBS_ABSOLUTE ${${var_name}})
+ endforeach()
+ set(GDK_PIXBUF_LIBRARIES ${GDK_PIXBUF_LIBS_ABSOLUTE})
+endif(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
- # Report results
- IF(GDK_PIXBUF_LIBRARIES AND GDK_PIXBUF_INCLUDE_DIRS)
- SET(GDK_PIXBUF_FOUND 1)
- SET(GdkPixbuf_FOUND 1)
- IF(NOT GdkPixbuf_FIND_QUIETLY)
- MESSAGE(STATUS "Found GdkPixbuf: ${GDK_PIXBUF_LIBRARIES}")
- ENDIF(NOT GdkPixbuf_FIND_QUIETLY)
- ELSE(GDK_PIXBUF_LIBRARIES AND GDK_PIXBUF_INCLUDE_DIRS)
- IF(GdkPixbuf_FIND_REQUIRED)
- MESSAGE(SEND_ERROR "Could not find GdkPixbuf")
- ELSE(GdkPixbuf_FIND_REQUIRED)
- IF(NOT GdkPixbuf_FIND_QUIETLY)
- MESSAGE(STATUS "Could not find GdkPixbuf")
- ENDIF(NOT GdkPixbuf_FIND_QUIETLY)
- ENDIF(GdkPixbuf_FIND_REQUIRED)
- ENDIF(GDK_PIXBUF_LIBRARIES AND GDK_PIXBUF_INCLUDE_DIRS)
-ELSE(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
- SET(GdkPixbuf_FOUND 1)
-ENDIF(NOT GDK_PIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
-
-# Hide advanced variables from CMake GUIs
-MARK_AS_ADVANCED(GDK_PIXBUF_LIBRARIES GDK_PIXBUF_INCLUDE_DIRS)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDK_PIXBUF DEFAULT_MSG GDK_PIXBUF_LIBRARIES GDK_PIXBUF_INCLUDE_DIRS)
+mark_as_advanced(GDK_PIXBUF_LIBRARIES GDK_PIXBUF_INCLUDE_DIRS)