summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-03-21 23:06:29 +0900
committerSlávek Banko <slavek.banko@axis.cz>2019-03-31 15:03:51 +0200
commit2d2d8bba9f492b479ffb0f577cd2b2f65edf4167 (patch)
treec4df57d8d4183bb5cfaf5c4f8806a99ffdc0e31b
parent2ec4f38c780d149285ebc780db163d521a6ba674 (diff)
downloadkpilot-2d2d8bba9f492b479ffb0f577cd2b2f65edf4167.tar.gz
kpilot-2d2d8bba9f492b479ffb0f577cd2b2f65edf4167.zip
Fixed support for tests in cmake.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 5ea733c60c8f6323cf94b726b997e8e22bca191f)
-rw-r--r--CMakeLists.txt4
-rw-r--r--tests/CMakeLists.txt106
-rw-r--r--tests/importaddresses.cc3
3 files changed, 71 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 543953b..4e6dc68 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ include( CheckIncludeFile )
include( CheckFunctionExists )
include( CheckLibraryExists )
include( CheckSymbolExists )
-
+enable_testing( )
#### include our cmake modules ##################
@@ -73,6 +73,8 @@ set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined"
add_subdirectory( lib )
add_subdirectory( kpilot )
add_subdirectory( conduits )
+add_subdirectory( tests )
+
tde_conditional_add_subdirectory( BUILD_DOC doc )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po )
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 076f0c9..f27f41a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,51 +1,79 @@
-link_directories(${CMAKE_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR})
-include_directories(${CMAKE_SOURCE_DIR}/lib ${CMAKE_BINARY_DIR}/lib)
+#################################################
+#
+# (C) 2019 Michele Calgaro
+# michele (DOT) calgaro (AT) yahoo (DOT) it
+#
+# Improvements and feedbacks are welcome
+#
+# This file is released under GPL >= 3
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${TDE_INCLUDE_DIR}
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/lib
+ ${CMAKE_BINARY_DIR}/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+link_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/lib
+)
# Tests don't need to go into toplevel/bin, they are fine in the current dir.
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
-set(testconstants_SRCS testconstants.cc)
-trinity_add_executable(testconstants ${testconstants_SRCS})
-target_link_libraries(testconstants kpilot ${QT_LIBRARIES})
-add_test(testconstants ${EXECUTABLE_OUTPUT_PATH}/testconstants)
+tde_add_check_executable( testconstants
+ SOURCES testconstants.cc
+ LINK kpilot-shared ${TQT_LIBRARIES}
+ TEST
+)
-set(testcategories_SRCS testcategories.cc)
-trinity_add_executable(testcategories ${testcategories_SRCS})
-target_link_libraries(testcategories kpilot ${QT_LIBRARIES})
-add_test(testcategories ${EXECUTABLE_OUTPUT_PATH}/testcategories)
+tde_add_check_executable( testcategories
+ SOURCES testcategories.cc
+ LINK kpilot-shared ${TQT_LIBRARIES}
+ TEST
+)
-set(testaddresses_SRCS testaddress.cc)
-trinity_add_executable(testaddresses ${testaddresses_SRCS})
-target_link_libraries(testaddresses kpilot ${QT_LIBRARIES})
-add_test(testaddresses ${EXECUTABLE_OUTPUT_PATH}/testaddresses)
+tde_add_check_executable( testaddresses
+ SOURCES testaddress.cc
+ LINK kpilot-shared ${TQT_LIBRARIES}
+ TEST
+)
-set(testdatebook_SRCS testdatebook.cc)
-trinity_add_executable(testdatebook ${testdatebook_SRCS})
-target_link_libraries(testdatebook kpilot ${QT_LIBRARIES})
-add_test(testdatebook ${EXECUTABLE_OUTPUT_PATH}/testdatebook)
+tde_add_check_executable( testdatebook
+ SOURCES testdatebook.cc
+ LINK kpilot-shared ${TQT_LIBRARIES}
+ TEST
+)
-set(testidmapper_SRCS testidmapper.cc)
-trinity_add_executable(testidmapper ${testidmapper_SRCS})
-target_link_libraries(testidmapper kpilot ${QT_LIBRARIES})
-add_test(testidmapper ${EXECUTABLE_OUTPUT_PATH}/testidmapper)
+tde_add_check_executable( importaddresses
+ SOURCES importaddresses.cc
+ LINK kpilot-shared tdeabc-shared tdeabc_file-shared ${TQT_LIBRARIES}
+)
+add_test(importaddresses ${EXECUTABLE_OUTPUT_PATH}/importaddresses --data-dir "${CMAKE_CURRENT_BINARY_DIR}" --address-file "${CMAKE_CURRENT_SOURCE_DIR}/data/AddressDB.pdb")
if (HAVE_CALENDARLOCAL_H)
- set(importdatebook_SRCS importdatebook.cc)
- set(exportdatebook_SRCS exportdatebook.cc)
- set(mergecalendars_SRCS mergecalendars.cc)
- trinity_add_executable(importdatebook ${importdatebook_SRCS})
- trinity_add_executable(exportdatebook ${exportdatebook_SRCS})
- trinity_add_executable(mergecalendars ${mergecalendars_SRCS})
- target_link_libraries(importdatebook kpilot ${QT_LIBRARIES} kcal)
- target_link_libraries(exportdatebook kpilot ${QT_LIBRARIES} kcal)
- target_link_libraries(mergecalendars ${QT_LIBRARIES} kcal)
- add_test(importdatebook ${EXECUTABLE_OUTPUT_PATH}/importdatebook)
- add_test(exportdatebook ${EXECUTABLE_OUTPUT_PATH}/exportdatebook)
- add_test(mergecalendars ${EXECUTABLE_OUTPUT_PATH}/mergecalendars)
-endif (HAVE_CALENDARLOCAL_H)
+ tde_add_check_executable( importdatebook
+ SOURCES importdatebook.cc
+ LINK kpilot-shared kcal-shared ${TQT_LIBRARIES}
+ TEST
+ )
-set(importaddresses_SRCS importaddresses.cc)
-trinity_add_executable(importaddresses ${importaddresses_SRCS})
-target_link_libraries(importaddresses kpilot ${QT_LIBRARIES} tdeabc tdeabc_file)
-add_test(importaddresses ${EXECUTABLE_OUTPUT_PATH}/importaddresses)
+ tde_add_check_executable( exportdatebook
+ SOURCES exportdatebook.cc
+ LINK kpilot-shared kcal-shared ${TQT_LIBRARIES}
+ TEST
+ )
+ tde_add_check_executable( mergecalendars
+ SOURCES mergecalendars.cc
+ LINK kpilot-shared kcal-shared ${TQT_LIBRARIES}
+ TEST
+ )
+endif (HAVE_CALENDARLOCAL_H)
diff --git a/tests/importaddresses.cc b/tests/importaddresses.cc
index 7900423..032a14f 100644
--- a/tests/importaddresses.cc
+++ b/tests/importaddresses.cc
@@ -59,8 +59,7 @@ int main(int argc, char **argv)
TDECmdLineArgs::init(argc,argv,&aboutData);
TDECmdLineArgs::addCmdLineOptions( options );
- // TDEApplication app( false, false );
- TDEApplication app;
+ TDEApplication app( false, false );
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();