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/FindATK.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/FindATK.cmake')
-rw-r--r-- | cmake/FindATK.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cmake/FindATK.cmake b/cmake/FindATK.cmake new file mode 100644 index 00000000..bdd25897 --- /dev/null +++ b/cmake/FindATK.cmake @@ -0,0 +1,32 @@ +include(PkgConfigWithFallback) +find_pkg_config_with_fallback(ATK + PKG_CONFIG_NAME atk + LIB_NAMES atk-1.0 + INCLUDE_NAMES atk/atk.h + INCLUDE_DIR_SUFFIXES atk-1.0 atk-1.0/include + DEPENDS GObject +) + +if(ATK_FOUND AND NOT ATK_VERSION) + find_path(ATK_INCLUDE_DIR "atk/atk.h" HINTS ${ATK_INCLUDE_DIRS}) + + if(ATK_INCLUDE_DIR) + file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define ATK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MAJOR_VERSION "${ATK_MAJOR_VERSION}") + file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MINOR_VERSION REGEX "^#define ATK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define ATK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MINOR_VERSION "${ATK_MINOR_VERSION}") + file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MICRO_VERSION REGEX "^#define ATK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + string(REGEX REPLACE "^#define ATK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MICRO_VERSION "${ATK_MICRO_VERSION}") + set(ATK_VERSION "${ATK_MAJOR_VERSION}.${ATK_MINOR_VERSION}.${ATK_MICRO_VERSION}") + unset(ATK_MAJOR_VERSION) + unset(ATK_MINOR_VERSION) + unset(ATK_MICRO_VERSION) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ATK + FOUND_VAR ATK_FOUND + REQUIRED_VARS ATK_LIBRARY + VERSION_VAR ATK_VERSION +)
\ No newline at end of file |