project( ept )

set( EPT_VERSION "0.4.7" )

file( GLOB h_top *.h )
file( GLOB tcc_top *.tcc )
file( GLOB h_configuration configuration/*.h )
file( GLOB h_cache cache/*.h )
file( GLOB h_actor actor/*.h )
file( GLOB h_predicate predicate/*.h )
file( GLOB tcc_cache cache/*.tcc )
file( GLOB h_cache_apt cache/apt/*.h )
file( GLOB tcc_cache_apt cache/apt/*.tcc )
file( GLOB h_debtags cache/debtags/*.h )
file( GLOB tcc_debtags cache/debtags/*.tcc )

file( GLOB src *.cpp cache/*.cpp cache/*/*.cpp predicate/*.cpp )

install_files( /include/ept/ .h ${h_top} )
install_files( /include/ept/ .tcc ${tcc_top} )
install_files( /include/ept/configuration/ .h ${h_configuration} )
install_files( /include/ept/cache/ .h ${h_cache} )
install_files( /include/ept/actor/ .h ${h_actor} )
install_files( /include/ept/predicate/ .h ${h_predicate} )
install_files( /include/ept/cache/ .tcc ${tcc_cache} )
install_files( /include/ept/cache/apt/ .h ${h_cache_apt} )
install_files( /include/ept/cache/apt/ .tcc ${tcc_cache_apt} )
install_files( /include/ept/cache/debtags/ .h ${h_debtags} )
install_files( /include/ept/cache/debtags/ .tcc ${tcc_debtags} )

set_source_files_properties( ${src} COMPILE_FLAGS -fPIC )

add_definitions( ${OPT_FLAGS} ${GC_DEFS} )
include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${TC_INCLUDES}
  ${WIBBLE_INCLUDES} ${APT_INCLUDES} ${SIGC_INCLUDES} )
link_directories( ${TC_LINKDIRS} ${APT_LINKDIRS} ${WIBBLE_LINKDIRS} ${SIGC_LINKDIRS} )

add_library( ept STATIC ${src})
target_link_libraries( ept apt-pkg ${WIBBLE_LIBS} ${TC_LIBS} z ${SIGC_LIBS} ${GC_LIBS} )
set_target_properties( ept PROPERTIES VERSION ${EPT_VERSION} )
install_targets( /lib ept )

add_subdirectory( tests )

#SET( _DIR ${ept_BINARY_DIR}/tests/work/ )
SET( TEST_DIR ${ept_BINARY_DIR}/tests/work/ )

CONFIGURE_FILE( ${ept_SOURCE_DIR}/config.h.cmake-in
  ${ept_BINARY_DIR}/config.h )

configure_file( ${ept_SOURCE_DIR}/libept.pc.cmake-in ${ept_BINARY_DIR}/libept.pc @ONLY )

install_files( /lib/pkgconfig FILES libept.pc )
install_files( /share/aclocal FILES libept.m4 )
