cmake_minimum_required (VERSION 2.6)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include (Util)

project ("polyol" C)

spec_get (recipe_version "version")
string (REGEX MATCH "^[0-9]+" MAJOR_VERSION ${recipe_version})
string (REGEX MATCH "[0-9]+$" MINOR_VERSION ${recipe_version})

find_package (PkgConfig REQUIRED)
find_package (Vala "0.12.0")
find_package (Pythons)

pkg_check (COMMON REQUIRED glib-2.0>=2.12 gobject-2.0 gconf-2.0 gee-1.0>=0.5 x11)
pkg_check (DBUS dbus-glib-1)
pkg_check (GTK "gtk+-2.0>=2.12" pango>=1.20 cairo librsvg-2.0)
pkg_check (PYGOBJECT pygobject-2.0)
pkg_check (PYGTK pygtk-2.0 pycairo)

# Do not rewrite generated files by default
setiif (MAINTAINER_MODE "${VALA_FOUND}")

# Bindings to build
setiif (BINDINGS "python")

add_subdirectory (src)
add_subdirectory (bindings)
add_subdirectory (tests)
add_subdirectory (examples)

message (STATUS "Useful variables:")
message (STATUS "  MAINTAINER_MODE        ${MAINTAINER_MODE}")
message (STATUS "  CMAKE_C_COMPILER       ${CMAKE_C_COMPILER}")
message (STATUS "  CMAKE_C_FLAGS          ${CMAKE_C_FLAGS}")
message (STATUS "  BINDINGS               ${BINDINGS}")
message (STATUS "  CMAKE_INSTALL_PREFIX   ${CMAKE_INSTALL_PREFIX}")
message (STATUS "  PYTHON_SITEDIR         ${PYTHON_SITEDIR}")
message (STATUS "Switch to ${CMAKE_BINARY_DIR} directory and")
message (STATUS "  run 'make' to build")
message (STATUS "  run 'make install' to install")

include (Dist)
