project(Adwaita)
cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_AUTOMOC ON)
add_definitions(-std=c++11)

option(USE_QT4 "Use Qt4 instead of Qt5" OFF)
if (USE_QT4)
    find_package(Qt4 REQUIRED)
    set(QT_VERSION_NUMBER "4")
else()
    find_package(Qt5Core REQUIRED)
    find_package(Qt5Gui REQUIRED)
    find_package(Qt5Widgets REQUIRED)
    set(QT_QTGUI_LIBRARY Qt5::Gui Qt5::Widgets)
    set(QT_QTCORE_LIBRARY Qt5::Core)
    #target_link_libraries(${LIBRARY_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
    set(QT_VERSION_NUMBER "5")
endif()

if (NOT CMAKE_INSTALL_PREFIX)
    set (CMAKE_INSTALL_PREFIX "/usr/local")
endif()

if (NOT QT_ROOT)
    set(QT_ROOT "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/qt${QT_VERSION_NUMBER}")
endif()

if (NOT QT_PLUGIN_PATH)
    set(QT_PLUGIN_PATH "${QT_ROOT}/plugins")
endif()
if (NOT QT_STYLE_PATH)
    set(QT_STYLE_PATH "${QT_PLUGIN_PATH}/styles")
endif()

if (NOT DATA_INSTALL_DIR)
    set (DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share")
endif()
if (NOT THEME_INSTALL_DIR)
    set (THEME_INSTALL_DIR "${DATA_INSTALL_DIR}/themes")
endif()

set(ADWAITA_THEME_DIR "${THEME_INSTALL_DIR}/Adwaita/qt")
set(ADWAITA_ASSET_DIR "${ADWAITA_THEME_DIR}/assets")

option(BUILD_EXAMPLE "Build an example widget factory app" OFF)
if (BUILD_EXAMPLE)
    if (USE_QT4)
        find_package(KDE4)
    else()
        error("It's not possible to build the example using Qt5 yet, sorry.")
    endif()
endif()

add_subdirectory(assets)
add_subdirectory(src)