aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindCairo.cmake
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-23 17:10:45 +0100
committerMarvin W <git@larma.de>2017-03-23 17:16:08 +0100
commite6f89f8751e6e65d4a36a125cc3fe398098ba504 (patch)
tree54acce89355ee07b05db761d6d0dad8dad4e0f36 /cmake/FindCairo.cmake
parentef0483765a0fd567f25b1f0af6df04e8973e5624 (diff)
downloaddino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.tar.gz
dino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.zip
New CMake
- add install and uninstall targets - compatibility for systems without pkg-config
Diffstat (limited to 'cmake/FindCairo.cmake')
-rw-r--r--cmake/FindCairo.cmake31
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake
new file mode 100644
index 00000000..5d2a2fbf
--- /dev/null
+++ b/cmake/FindCairo.cmake
@@ -0,0 +1,31 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Cairo
+ PKG_CONFIG_NAME cairo
+ LIB_NAMES cairo
+ INCLUDE_NAMES cairo.h
+ INCLUDE_DIR_SUFFIXES cairo cairo/include
+)
+
+if(Cairo_FOUND AND NOT Cairo_VERSION)
+ find_path(Cairo_INCLUDE_DIR "cairo.h" HINTS ${Cairo_INCLUDE_DIRS})
+
+ if(Cairo_INCLUDE_DIR)
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MAJOR_VERSION REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MAJOR_VERSION "${Cairo_MAJOR_VERSION}")
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MINOR_VERSION REGEX "^#define CAIRO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MINOR_VERSION "${Cairo_MINOR_VERSION}")
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MICRO_VERSION REGEX "^#define CAIRO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Cairo_MICRO_VERSION "${Cairo_MICRO_VERSION}")
+ set(Cairo_VERSION "${Cairo_MAJOR_VERSION}.${Cairo_MINOR_VERSION}.${Cairo_MICRO_VERSION}")
+ unset(Cairo_MAJOR_VERSION)
+ unset(Cairo_MINOR_VERSION)
+ unset(Cairo_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Cairo
+ FOUND_VAR Cairo_FOUND
+ REQUIRED_VARS Cairo_LIBRARY
+ VERSION_VAR Cairo_VERSION
+) \ No newline at end of file