#################################################
#
#  (C) 2016 Alexander Golubev
#  fatzer2 (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_BINARY_DIR}
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_BINARY_DIR}/tdecore
  ${CMAKE_SOURCE_DIR}/tdecore
  ${CMAKE_SOURCE_DIR}/dcop
)

link_directories(
  ${TDECORE_LIBRARY_DIRS}
)

tde_add_library( tdeconfigtest SHARED AUTOMOC
  SOURCES tdeconfigtest.cpp
  LINK tdeunittest-shared
  EXCLUDE_FROM_ALL
)

set( AUTOMATED_CHECKS
  kcharsetstest kglobaltest kmacroexpandertest krfcdatetest
  kstringhandlertest kurltest tdestdacceltest

  # cplusplustest      # -- skip (doesn't error on errors)
  # ksimpleconfigtest  # -- skip (doesn't error on errors)
  # ksortablevaluelist # -- skip (doesn't error on errors)
  # ksocktest          # -- skip due to DNS failure
)

# Tests that require some graphical interaction / confirmation.
set( MANUAL_CHECKS_GUI
  kdebugtest klocaletest knotifytest kxerrorhandlertest
  startserviceby tdeconfigtestgui kprocesstest testqtargs
)

# Tests that require some interaction using a terminal
set( MANUAL_CHECKS_TUI
  dcopkonqtest kcalendartest kcmdlineargstest kiconloadertest
  kipctest kmemtest krandomsequencetest kresolvertest
  kmdcodectest kshelltest ktempfiletest ktimezonestest
  kapptest kprociotest kstandarddirstest kuniqueapptest
)

foreach( _check ${AUTOMATED_CHECKS} )
  tde_add_check_executable( ${_check} AUTOMOC LINK tdeconfigtest-shared TEST )
endforeach( )

foreach( _check ${MANUAL_CHECKS_GUI})
  tde_add_check_executable( ${_check} AUTOMOC LINK tdeconfigtest-shared )
endforeach()

foreach( _check ${MANUAL_CHECKS_TUI})
  tde_add_check_executable( ${_check} AUTOMOC LINK tdeconfigtest-shared )
endforeach()

tde_add_check_executable( kidlservertest AUTOMOC SOURCES KIDLTest.cpp KIDLTest.skel
  LINK tdeconfigtest-shared )
tde_add_check_executable( kidlclienttest AUTOMOC SOURCES KIDLTestClient.cpp
  KIDLTest.stub LINK tdeconfigtest-shared )

set_property(
  SOURCE KIDLTestClient.cpp
  APPEND PROPERTY
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/KIDLTest_stub.cpp
)
