project(qonjugator)
cmake_minimum_required(VERSION 2.6)

#set(CMAKE_VERBOSE_MAKEFILE on)

# find FindQonjugatorLib.cmake module
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/qonjugatorlib ${CMAKE_MODULE_PATH})

# make sure that the uninstall rule is not created by us, KDE4's cmake rules
# will create the rule in the plasma-applet-qonjugator directory
set(qonjugator_compile_not_standalone TRUE)

include(ConfigureDefaults.cmake) # need to include this so that ${CMAKE_INSTALL_PREFIX} below has the correct value
set(QONJUGATORLIB_INCLUDE_DIR ${QONJUGATOR_INCLUDESDIR}/..)
set(QONJUGATORLIB_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/qonjugatorlib/libqonjugatorcore.so)
include_directories(./qonjugatorlib)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/qonjugatorlib)

add_custom_target(uninstalldirs)
add_custom_command(TARGET uninstalldirs
                   POST_BUILD
                   COMMAND rmdir ${CMAKE_INSTALL_PREFIX}/include/qonjugator
                   COMMAND rmdir ${CMAKE_INSTALL_PREFIX}/share/qonjugator
                   COMMAND rmdir ${CMAKE_INSTALL_PREFIX}/lib/qonjugatorplugins
                   COMMENT "Removing directories ${CMAKE_INSTALL_PREFIX}/include/qonjugator ${CMAKE_INSTALL_PREFIX}/share/qonjugator ${CMAKE_INSTALL_PREFIX}/lib/qonjugatorplugins if empty"
                   VERBATIM)

add_subdirectory(qonjugatorlib)
add_subdirectory(qonjugatorgui)
add_subdirectory(qonjugatorcli)
add_subdirectory(qonjugatorplugin_es)
add_subdirectory(qonjugatorplugin_fr)
add_subdirectory(qonjugatorplugin_it)

find_package(KDE4 REQUIRED)
add_subdirectory(plasma-applet-qonjugator)
