diff options
author | Marvin W <git@larma.de> | 2017-03-23 17:10:45 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-23 17:16:08 +0100 |
commit | e6f89f8751e6e65d4a36a125cc3fe398098ba504 (patch) | |
tree | 54acce89355ee07b05db761d6d0dad8dad4e0f36 /cmake/FindLibnotify.cmake | |
parent | ef0483765a0fd567f25b1f0af6df04e8973e5624 (diff) | |
download | dino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.tar.gz dino-e6f89f8751e6e65d4a36a125cc3fe398098ba504.zip |
New CMake
- add install and uninstall targets
- compatibility for systems without pkg-config
Diffstat (limited to 'cmake/FindLibnotify.cmake')
-rw-r--r-- | cmake/FindLibnotify.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/FindLibnotify.cmake b/cmake/FindLibnotify.cmake new file mode 100644 index 00000000..468ef0c9 --- /dev/null +++ b/cmake/FindLibnotify.cmake @@ -0,0 +1,31 @@ +include(PkgConfigWithFallback) +find_pkg_config_with_fallback(Libnotify + PKG_CONFIG_NAME libnotify + LIB_NAMES notify + INCLUDE_NAMES libnotify/notify.h + DEPENDS GIO GDKPixbuf2 +) + +if(Libnotify_FOUND AND NOT Libnotify_VERSION) + find_path(Libnotify_INCLUDE_DIR "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS}) + + if(Libnotify_INCLUDE_DIR) + file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MAJOR_VERSION REGEX "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MAJOR_VERSION "${Libnotify_MAJOR_VERSION}") + file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MINOR_VERSION REGEX "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MINOR_VERSION "${Libnotify_MINOR_VERSION}") + file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MICRO_VERSION REGEX "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MICRO_VERSION "${Libnotify_MICRO_VERSION}") + set(Libnotify_VERSION "${Libnotify_MAJOR_VERSION}.${Libnotify_MINOR_VERSION}.${Libnotify_MICRO_VERSION}") + unset(Libnotify_MAJOR_VERSION) + unset(Libnotify_MINOR_VERSION) + unset(Libnotify_MICRO_VERSION) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libnotify + FOUND_VAR Libnotify_FOUND + REQUIRED_VARS Libnotify_LIBRARY + VERSION_VAR Libnotify_VERSION +)
\ No newline at end of file |