aboutsummaryrefslogtreecommitdiff
path: root/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
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')
-rw-r--r--cmake/FindATK.cmake32
-rw-r--r--cmake/FindCairo.cmake31
-rw-r--r--cmake/FindGDK3.cmake32
-rw-r--r--cmake/FindGDKPixbuf2.cmake24
-rw-r--r--cmake/FindGIO.cmake20
-rw-r--r--cmake/FindGLib.cmake33
-rw-r--r--cmake/FindGModule.cmake20
-rw-r--r--cmake/FindGObject.cmake20
-rw-r--r--cmake/FindGPGME.cmake17
-rw-r--r--cmake/FindGTK3.cmake32
-rw-r--r--cmake/FindGee.cmake15
-rw-r--r--cmake/FindLibnotify.cmake31
-rw-r--r--cmake/FindPango.cmake32
-rw-r--r--cmake/FindSQLite3.cmake22
-rw-r--r--cmake/FindVala.cmake1
-rw-r--r--cmake/MultiFind.cmake45
-rw-r--r--cmake/PkgConfigWithFallback.cmake99
-rw-r--r--cmake/UseVala.cmake18
-rw-r--r--cmake/cmake_uninstall.cmake.in21
19 files changed, 539 insertions, 6 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
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
diff --git a/cmake/FindGDK3.cmake b/cmake/FindGDK3.cmake
new file mode 100644
index 00000000..fd5061c0
--- /dev/null
+++ b/cmake/FindGDK3.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GDK3
+ PKG_CONFIG_NAME gdk-3.0
+ LIB_NAMES gdk-3
+ INCLUDE_NAMES gdk/gdk.h
+ INCLUDE_DIR_SUFFIXES gtk-3.0 gtk-3.0/include gtk+-3.0 gtk+-3.0/include
+ DEPENDS Pango Cairo GDKPixbuf2
+)
+
+if(GDK3_FOUND AND NOT GDK3_VERSION)
+ find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS})
+
+ if(GDK3_INCLUDE_DIR)
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MAJOR_VERSION "${GDK3_MAJOR_VERSION}")
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MINOR_VERSION "${GDK3_MINOR_VERSION}")
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MICRO_VERSION "${GDK3_MICRO_VERSION}")
+ set(GDK3_VERSION "${GDK3_MAJOR_VERSION}.${GDK3_MINOR_VERSION}.${GDK3_MICRO_VERSION}")
+ unset(GDK3_MAJOR_VERSION)
+ unset(GDK3_MINOR_VERSION)
+ unset(GDK3_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDK3
+ FOUND_VAR GDK3_FOUND
+ REQUIRED_VARS GDK3_LIBRARY
+ VERSION_VAR GDK3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGDKPixbuf2.cmake b/cmake/FindGDKPixbuf2.cmake
new file mode 100644
index 00000000..d100deea
--- /dev/null
+++ b/cmake/FindGDKPixbuf2.cmake
@@ -0,0 +1,24 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GDKPixbuf2
+ PKG_CONFIG_NAME gdk-pixbuf-2.0
+ LIB_NAMES gdk_pixbuf-2.0
+ INCLUDE_NAMES gdk-pixbuf/gdk-pixbuf.h
+ INCLUDE_DIR_SUFFIXES gdk-pixbuf-2.0 gdk-pixbuf-2.0/include
+ DEPENDS GLib
+)
+
+if(GDKPixbuf2_FOUND AND NOT GDKPixbuf2_VERSION)
+ find_path(GDKPixbuf2_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS})
+
+ if(GDKPixbuf2_INCLUDE_DIR)
+ file(STRINGS "${GDKPixbuf2_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf2_VERSION REGEX "^#define GDK_PIXBUF_VERSION \\\"[^\\\"]+\\\"")
+ string(REGEX REPLACE "^#define GDK_PIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf2_VERSION "${GDKPixbuf2_VERSION}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDKPixbuf2
+ FOUND_VAR GDKPixbuf2_FOUND
+ REQUIRED_VARS GDKPixbuf2_LIBRARY
+ VERSION_VAR GDKPixbuf2_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGIO.cmake b/cmake/FindGIO.cmake
new file mode 100644
index 00000000..d65749dd
--- /dev/null
+++ b/cmake/FindGIO.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GIO
+ PKG_CONFIG_NAME gio-2.0
+ LIB_NAMES gio-2.0
+ INCLUDE_NAMES gio/gio.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GObject
+)
+
+if(GIO_FOUND AND NOT GIO_VERSION)
+ find_package(GLib)
+ set(GIO_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GIO
+ FOUND_VAR GIO_FOUND
+ REQUIRED_VARS GIO_LIBRARY
+ VERSION_VAR GIO_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGLib.cmake b/cmake/FindGLib.cmake
new file mode 100644
index 00000000..eb054e65
--- /dev/null
+++ b/cmake/FindGLib.cmake
@@ -0,0 +1,33 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GLib
+ PKG_CONFIG_NAME glib-2.0
+ LIB_NAMES glib-2.0
+ INCLUDE_NAMES glib.h glibconfig.h
+ INCLUDE_DIR_HINTS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH}
+ INCLUDE_DIR_PATHS ${CMAKE_PREFIX_PATH}/lib64 ${CMAKE_PREFIX_PATH}/lib
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+)
+
+if(GLib_FOUND AND NOT GLib_VERSION)
+ find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS})
+
+ if(GLib_CONFIG_INCLUDE_DIR)
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}")
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}")
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}")
+ set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}")
+ unset(GLib_MAJOR_VERSION)
+ unset(GLib_MINOR_VERSION)
+ unset(GLib_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLib
+ FOUND_VAR GLib_FOUND
+ REQUIRED_VARS GLib_LIBRARY
+ VERSION_VAR GLib_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGModule.cmake b/cmake/FindGModule.cmake
new file mode 100644
index 00000000..61233145
--- /dev/null
+++ b/cmake/FindGModule.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GModule
+ PKG_CONFIG_NAME gmodule-2.0
+ LIB_NAMES gmodule-2.0
+ INCLUDE_NAMES gmodule.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GLib
+)
+
+if(GModule_FOUND AND NOT GModule_VERSION)
+ find_package(GLib)
+ set(GModule_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GModule
+ FOUND_VAR GModule_FOUND
+ REQUIRED_VARS GModule_LIBRARY
+ VERSION_VAR GModule_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGObject.cmake b/cmake/FindGObject.cmake
new file mode 100644
index 00000000..22327469
--- /dev/null
+++ b/cmake/FindGObject.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GObject
+ PKG_CONFIG_NAME gobject-2.0
+ LIB_NAMES gobject-2.0
+ INCLUDE_NAMES gobject/gobject.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GLib
+)
+
+if(GObject_FOUND AND NOT GObject_VERSION)
+ find_package(GLib)
+ set(GObject_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GObject
+ FOUND_VAR GObject_FOUND
+ REQUIRED_VARS GObject_LIBRARY
+ VERSION_VAR GObject_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGPGME.cmake b/cmake/FindGPGME.cmake
index fd096363..90f734fe 100644
--- a/cmake/FindGPGME.cmake
+++ b/cmake/FindGPGME.cmake
@@ -1,4 +1,4 @@
-# TODO: Windows related stuff
+set(GPGME_PKG_CONFIG_NAME gpgme)
find_program(GPGME_CONFIG_EXECUTABLE NAMES gpgme-config)
mark_as_advanced(GPGME_CONFIG_EXECUTABLE)
@@ -17,11 +17,22 @@ if(GPGME_CONFIG_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GPGME_CONFIG_EXECUTABLE} --libs
- OUTPUT_VARIABLE GPGME_LIBRARIES
+ OUTPUT_VARIABLE GPGME_LDFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REGEX REPLACE "^(.* |)-l([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY "${GPGME_LDFLAGS}")
+ string(REGEX REPLACE "^(.* |)-L([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}")
+ find_library(LIB_NAME_GPGME ${GPGME_LIBRARY} HINTS ${GPGME_LIBRARY_DIRS})
+ set(GPGME_LIBRARY ${LIB_NAME_GPGME})
+
+ if(NOT TARGET gpgme)
+ add_library(gpgme SHARED IMPORTED)
+ set_property(TARGET gpgme PROPERTY IMPORTED_LOCATION "${GPGME_LIBRARY}")
+ set_property(TARGET gpgme PROPERTY INTERFACE_COMPILE_OPTIONS "${GPGME_CFLAGS}")
+ endif(NOT TARGET gpgme)
endif(GPGME_CONFIG_EXECUTABLE)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GPGME
- REQUIRED_VARS GPGME_CONFIG_EXECUTABLE
+ REQUIRED_VARS GPGME_LIBRARY
VERSION_VAR GPGME_VERSION) \ No newline at end of file
diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake
new file mode 100644
index 00000000..f70c23c2
--- /dev/null
+++ b/cmake/FindGTK3.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GTK3
+ PKG_CONFIG_NAME gtk+-3.0
+ LIB_NAMES gtk-3
+ INCLUDE_NAMES gtk/gtk.h
+ INCLUDE_DIR_SUFFIXES gtk-3.0 gtk-3.0/include gtk+-3.0 gtk+-3.0/include
+ DEPENDS GDK3 ATK
+)
+
+if(GTK3_FOUND AND NOT GTK3_VERSION)
+ find_path(GTK3_INCLUDE_DIR "gtk/gtk.h" HINTS ${GTK3_INCLUDE_DIRS})
+
+ if(GTK3_INCLUDE_DIR)
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MAJOR_VERSION "${GTK3_MAJOR_VERSION}")
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MINOR_VERSION "${GTK3_MINOR_VERSION}")
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MICRO_VERSION "${GTK3_MICRO_VERSION}")
+ set(GTK3_VERSION "${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_MICRO_VERSION}")
+ unset(GTK3_MAJOR_VERSION)
+ unset(GTK3_MINOR_VERSION)
+ unset(GTK3_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GTK3
+ FOUND_VAR GTK3_FOUND
+ REQUIRED_VARS GTK3_LIBRARY
+ VERSION_VAR GTK3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGee.cmake b/cmake/FindGee.cmake
new file mode 100644
index 00000000..32232d52
--- /dev/null
+++ b/cmake/FindGee.cmake
@@ -0,0 +1,15 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Gee
+ PKG_CONFIG_NAME gee-0.8
+ LIB_NAMES gee-0.8
+ INCLUDE_NAMES gee.h
+ INCLUDE_DIR_SUFFIXES gee-0.8 gee-0.8/include
+ DEPENDS GObject
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gee
+ FOUND_VAR Gee_FOUND
+ REQUIRED_VARS Gee_LIBRARY
+ VERSION_VAR Gee_VERSION
+) \ No newline at end of file
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
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
new file mode 100644
index 00000000..b934c6ff
--- /dev/null
+++ b/cmake/FindPango.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Pango
+ PKG_CONFIG_NAME pango
+ LIB_NAMES pango-1.0
+ INCLUDE_NAMES pango/pango.h
+ INCLUDE_DIR_SUFFIXES pango-1.0 pango-1.0/include
+ DEPENDS GObject
+)
+
+if(Pango_FOUND AND NOT Pango_VERSION)
+ find_path(Pango_INCLUDE_DIR "pango/pango.h" HINTS ${Pango_INCLUDE_DIRS})
+
+ if(Pango_INCLUDE_DIR)
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Pango_MAJOR_VERSION "${Pango_MAJOR_VERSION}")
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MINOR_VERSION REGEX "^#define PANGO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Pango_MINOR_VERSION "${Pango_MINOR_VERSION}")
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MICRO_VERSION REGEX "^#define PANGO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Pango_MICRO_VERSION "${Pango_MICRO_VERSION}")
+ set(Pango_VERSION "${Pango_MAJOR_VERSION}.${Pango_MINOR_VERSION}.${Pango_MICRO_VERSION}")
+ unset(Pango_MAJOR_VERSION)
+ unset(Pango_MINOR_VERSION)
+ unset(Pango_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Pango
+ FOUND_VAR Pango_FOUND
+ REQUIRED_VARS Pango_LIBRARY
+ VERSION_VAR Pango_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake
new file mode 100644
index 00000000..bf258997
--- /dev/null
+++ b/cmake/FindSQLite3.cmake
@@ -0,0 +1,22 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(SQLite3
+ PKG_CONFIG_NAME sqlite3
+ LIB_NAMES sqlite3
+ INCLUDE_NAMES sqlite3.h
+)
+
+if(SQLite3_FOUND AND NOT SQLite3_VERSION)
+ find_path(SQLite3_INCLUDE_DIR "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS})
+
+ if(SQLite3_INCLUDE_DIR)
+ file(STRINGS "${SQLite3_INCLUDE_DIR}/sqlite3.h" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"")
+ string(REGEX REPLACE "^#define SQLITE_VERSION +\\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" SQLite3_VERSION "${SQLite3_VERSION}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SQLite3
+ FOUND_VAR SQLite3_FOUND
+ REQUIRED_VARS SQLite3_LIBRARY
+ VERSION_VAR SQLite3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake
index 5150a7d9..371daaf5 100644
--- a/cmake/FindVala.cmake
+++ b/cmake/FindVala.cmake
@@ -46,6 +46,7 @@
# Search for the valac executable in the usual system paths
# Some distributions rename the valac to contain the major.minor in the binary name
+find_package(GObject REQUIRED)
find_program(VALA_EXECUTABLE NAMES valac valac-0.20 valac-0.18 valac-0.16 valac-0.14 valac-0.12 valac-0.10)
mark_as_advanced(VALA_EXECUTABLE)
diff --git a/cmake/MultiFind.cmake b/cmake/MultiFind.cmake
new file mode 100644
index 00000000..b40a4677
--- /dev/null
+++ b/cmake/MultiFind.cmake
@@ -0,0 +1,45 @@
+include(CMakeParseArguments)
+
+function(find_packages result)
+ cmake_parse_arguments(ARGS "" "" "REQUIRED;OPTIONAL" ${ARGN})
+ set(_res "")
+ set(_res_libs "")
+ foreach(pkg ${ARGS_REQUIRED})
+ string(REPLACE ">=" ";" pkg_ ${pkg})
+ list(GET pkg_ "0" pkg)
+ list(LENGTH pkg_ pkg_has_version)
+ if(pkg_has_version GREATER 1)
+ list(GET pkg_ "1" pkg_version)
+ else()
+ if(${pkg}_GLOBAL_VERSION)
+ set(pkg_version ${${pkg}_GLOBAL_VERSION})
+ else()
+ unset(pkg_version)
+ endif()
+ endif()
+ find_package(${pkg} ${pkg_version} REQUIRED)
+ list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
+ list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ endforeach(pkg)
+ foreach(pkg ${ARGS_OPTIONAL})
+ string(REPLACE ">=" ";" pkg_ ${pkg})
+ list(GET pkg_ "0" pkg)
+ list(LENGTH pkg_ pkg_has_version)
+ if(pkg_has_version GREATER 1)
+ list(GET pkg_ "1" pkg_version)
+ else()
+ if(${pkg}_GLOBAL_VERSION)
+ set(pkg_version ${${pkg}_GLOBAL_VERSION})
+ else()
+ unset(pkg_version)
+ endif()
+ endif()
+ find_package(${pkg} ${pkg_version})
+ if(${pkg}_FOUND)
+ list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
+ list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ endif()
+ endforeach(pkg)
+ set(${result} "${_res}" PARENT_SCOPE)
+ set(${result}_LIBS "${_res_libs}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/PkgConfigWithFallback.cmake b/cmake/PkgConfigWithFallback.cmake
new file mode 100644
index 00000000..988e4564
--- /dev/null
+++ b/cmake/PkgConfigWithFallback.cmake
@@ -0,0 +1,99 @@
+include(CMakeParseArguments)
+
+function(find_pkg_config_with_fallback name)
+ cmake_parse_arguments(ARGS "" "PKG_CONFIG_NAME" "LIB_NAMES;LIB_DIR_HINTS;INCLUDE_NAMES;INCLUDE_DIR_PATHS;INCLUDE_DIR_HINTS;INCLUDE_DIR_SUFFIXES;DEPENDS" ${ARGN})
+ set(${name}_PKG_CONFIG_NAME ${ARGS_PKG_CONFIG_NAME} PARENT_SCOPE)
+ find_package(PkgConfig)
+
+ if(PKG_CONFIG_FOUND)
+ pkg_search_module(${name}_PKG_CONFIG QUIET ${ARGS_PKG_CONFIG_NAME})
+ endif(PKG_CONFIG_FOUND)
+
+ if (${name}_PKG_CONFIG_FOUND)
+ # Found via pkg-config, using it's result values
+ set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND})
+
+ # Try to find real file name of libraries
+ foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
+ find_library(LIB_NAME_${lib} ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
+ if(NOT LIB_NAME_${lib})
+ unset(${name}_FOUND)
+ endif(NOT LIB_NAME_${lib})
+ endforeach(lib)
+ if(${name}_FOUND)
+ set(${name}_LIBRARIES "")
+ foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
+ list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ endforeach(lib)
+ list(REMOVE_DUPLICATES ${name}_LIBRARIES)
+ set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
+ list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
+
+ set(${name}_FOUND ${${name}_FOUND} PARENT_SCOPE)
+ set(${name}_INCLUDE_DIRS ${${name}_PKG_CONFIG_INCLUDE_DIRS} PARENT_SCOPE)
+ set(${name}_LIBRARIES ${${name}_PKG_CONFIG_LIBRARIES} PARENT_SCOPE)
+ set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE)
+ set(${name}_VERSION ${${name}_PKG_CONFIG_VERSION} PARENT_SCOPE)
+
+ if(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ add_library(${ARGS_PKG_CONFIG_NAME} INTERFACE IMPORTED)
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_COMPILE_OPTIONS "${${name}_PKG_CONFIG_CFLAGS_OTHER}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${name}_PKG_CONFIG_INCLUDE_DIRS}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_LINK_LIBRARIES "${${name}_LIBRARIES}")
+ endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ endif(${name}_FOUND)
+ else(${name}_PKG_CONFIG_FOUND)
+ # No success with pkg-config, try via find_library on all lib_names
+ set(${name}_FOUND "1")
+ foreach(lib ${ARGS_LIB_NAMES})
+ find_library(LIB_NAME_${lib} ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS})
+
+ if(NOT LIB_NAME_${lib})
+ unset(${name}_FOUND)
+ endif(NOT LIB_NAME_${lib})
+ endforeach(lib)
+
+ foreach(inc ${ARGS_INCLUDE_NAMES})
+ find_path(INCLUDE_PATH_${inc} ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES})
+
+ if(NOT INCLUDE_PATH_${inc})
+ unset(${name}_FOUND)
+ endif(NOT INCLUDE_PATH_${inc})
+ endforeach(inc)
+
+ if(${name}_FOUND)
+ set(${name}_LIBRARIES "")
+ set(${name}_INCLUDE_DIRS "")
+ foreach(lib ${ARGS_LIB_NAMES})
+ list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ endforeach(lib)
+ foreach(inc ${ARGS_INCLUDE_NAMES})
+ list(APPEND ${name}_INCLUDE_DIRS ${INCLUDE_PATH_${inc}})
+ endforeach(inc)
+ list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
+
+ foreach(dep ${ARGS_DEPENDS})
+ find_package(${dep} QUIET)
+
+ if(${dep}_FOUND)
+ list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
+ list(APPEND ${name}_LIBRARIES ${${dep}_LIBRARIES})
+ else(${dep}_FOUND)
+ unset(${name}_FOUND)
+ endif(${dep}_FOUND)
+ endforeach(dep)
+
+ set(${name}_FOUND ${${name}_FOUND} PARENT_SCOPE)
+ set(${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS} PARENT_SCOPE)
+ set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
+ set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE)
+ unset(${name}_VERSION PARENT_SCOPE)
+
+ if(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ add_library(${ARGS_PKG_CONFIG_NAME} INTERFACE IMPORTED)
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${name}_INCLUDE_DIRS}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_LINK_LIBRARIES "${${name}_LIBRARIES}")
+ endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ endif(${name}_FOUND)
+ endif(${name}_PKG_CONFIG_FOUND)
+endfunction() \ No newline at end of file
diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake
index 94ea4534..820b6d82 100644
--- a/cmake/UseVala.cmake
+++ b/cmake/UseVala.cmake
@@ -116,9 +116,9 @@ endfunction()
function(vala_precompile output)
cmake_parse_arguments(ARGS "FAST_VAPI" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;EXPORTS_DIR"
- "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS;GRESOURCES" ${ARGN})
+ "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS;CUSTOM_DEPS;GRESOURCES" ${ARGN})
- if("Ninja" STREQUAL ${CMAKE_GENERATOR})
+ if("Ninja" STREQUAL ${CMAKE_GENERATOR} AND NOT DISABLE_FAST_VAPI)
set(ARGS_FAST_VAPI true)
endif()
@@ -165,6 +165,7 @@ function(vala_precompile output)
set(fast_vapi_files "")
set(out_files "")
set(out_extra_files "")
+ set(out_deps_files "")
set(vapi_arguments "")
if(ARGS_GENERATE_VAPI)
@@ -176,6 +177,11 @@ function(vala_precompile output)
if (NOT ARGS_GENERATE_HEADER)
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
endif(NOT ARGS_GENERATE_HEADER)
+
+ if(ARGS_PACKAGES)
+ string(REPLACE ";" "\\n" pkgs "${ARGS_PACKAGES};${ARGS_CUSTOM_DEPS}")
+ add_custom_command(OUTPUT "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.deps" COMMAND echo -e "\"${pkgs}\"" > "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.deps" COMMENT "Generating ${ARGS_GENERATE_VAPI}.deps")
+ endif(ARGS_PACKAGES)
endif(ARGS_GENERATE_VAPI)
set(header_arguments "")
@@ -186,6 +192,8 @@ function(vala_precompile output)
list(APPEND header_arguments "--internal-header=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER)
+ string(REPLACE " " ";" VALAC_FLAGS ${CMAKE_VALA_FLAGS})
+
if(ARGS_FAST_VAPI)
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
@@ -205,6 +213,7 @@ function(vala_precompile output)
ARGS
--fast-vapi ${fast_vapi_file}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_file}
DEPENDS
${in_file}
@@ -242,6 +251,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${fast_vapi_flags}
${in_file}
${custom_vapi_arguments}
@@ -269,6 +279,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_files}
${custom_vapi_arguments}
DEPENDS
@@ -303,6 +314,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_files}
${custom_vapi_arguments}
DEPENDS
@@ -314,4 +326,4 @@ function(vala_precompile output)
)
endif(ARGS_FAST_VAPI)
set(${output} ${out_files} PARENT_SCOPE)
-endfunction(vala_precompile)
+endfunction(vala_precompile) \ No newline at end of file
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 00000000..d0db323f
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling: $ENV{DESTDIR}${file}")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+ endif(NOT "${rm_retval}" STREQUAL 0)
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)