#################################################
#
#  (C) 2011 Timothy Pearson
#  kb9vqf (AT) pearsoncomputing.net
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

cmake_minimum_required( VERSION 2.8 )


##### general package setup #####################

project( kio-locate )


##### include essential cmake modules ###########

include( CheckCXXSourceCompiles )
include( CheckFunctionExists )
include( CheckIncludeFileCXX )
include( CheckLibraryExists )
include( CheckStructHasMember )
include( CheckSymbolExists )
include( CheckTypeSize )
include( FindPkgConfig )


##### include our cmake modules #################

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )


##### setup install paths #######################

include( TDESetupPaths )
tde_setup_paths( )

##### set version numbers #######################

# For versions that are stable set to 1, else to 0
SET(APPLICATION_STABLE 1)

SET(LIB_MAJOR 4)
SET(LIB_MINOR 9)
SET(LIB_RELEASE 3)
SET(LIB_SUB_RELEASE 1)
SET(APPLICATION_INTERNAL_VERSION "20070516")
SET(APPLICATION_DATE "2007-05-16")

SET(APPLICATION_NAME "${PROJECT_NAME}")
SET(APPLICATION_MAIN_VERSION "0.${LIB_MAJOR}.${LIB_MINOR}.${LIB_RELEASE}")

IF (APPLICATION_STABLE)
	SET(APPLICATION_STABLE_RELEASE ".${LIB_SUB_RELEASE}")
	SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
	SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}.${LIB_SUB_RELEASE}")
ELSE (APPLICATION_APPLICATION_STABLE "")
	SET(STABLE_RELEASE)
	SET(APPLICATION_VERSION "${APPLICATION_MAIN_VERSION}-${LIB_SUB_RELEASE}")
	SET(GENTOO_VERSION "${APPLICATION_MAIN_VERSION}_pre${LIB_SUB_RELEASE}")
ENDIF (APPLICATION_STABLE)

SET(VERSION ${APPLICATION_VERSION})

SET(STRIGI_VERSION "0.3.11")
SET(GENTOO_KEYWORDS "x86 ~ppc ~amd64")


##### user requested modules ####################

option( BUILD_ALL "Build all" OFF )
option( BUILD_DOC "Build doc" ${BUILD_ALL} )
option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
option( USE_STRIGI "Enable use of Strigi search support (disabled)" OFF )
option( USE_MENUDRAKE "Use 'menudrake' instead of 'kmenuedit' in Mandriva (auto)" ON )


##### configure checks ##########################

include( ConfigureChecks.cmake )


###### global compiler settings #################

add_definitions(
  -DHAVE_CONFIG_H
)

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS} -DTQT_THREAD_SUPPORT" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )


##### source directories ########################

add_subdirectory( kbfxlib )
add_subdirectory( src )
add_subdirectory( configdialog )
add_subdirectory( skin )
add_subdirectory( images )
add_subdirectory( plugins )
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )

SET(DIST_INCLUDE "kbfx-9999.ebuild kbfx.spec kbfx-${GENTOO_VERSION}.ebuild strigi-${STRIGI_VERSION}.ebuild")
SET(DIST_EXCLUDE "Helperstuff")


##### write configure files #####################

configure_file(config.h.in config.h @ONLY)
configure_file(kbfx.spec.in kbfx.spec @ONLY)
configure_file(kbfx.ebuild.in kbfx-${GENTOO_VERSION}.ebuild @ONLY)
configure_file(strigi.ebuild.in strigi-${STRIGI_VERSION}.ebuild @ONLY)
configure_file(kbfx-svn.ebuild.in kbfx-9999.ebuild @ONLY)
