- finalized unit tests transition to CMake
- introduced 2 variables to collect inlcude dirs and libraries
This commit is contained in:
Federico Hernandez 2011-01-03 01:05:39 +01:00
parent 3a599b66f5
commit 94224d0ac5
3 changed files with 110 additions and 7 deletions

View file

@ -31,6 +31,14 @@ endif (PTHREAD_INCLUDE_DIR AND PTHREAD_LIBRARY)
# set (HAVE_READLINE true)
#endif (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
set (TASK_INCLUDE_DIRS ${LUA_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${READLINE_INCLUDE_DIR})
set (TASK_LIBRARIES ${LUA_LIBRARIES}
${PTHREAD_LIBRARY}
${READLINE_LIBRARY})
check_function_exists (random HAVE_RANDOM)
check_function_exists (srandom HAVE_SRANDOM)
check_function_exists (uuid_unparse_lower HAVE_UUID)

View file

@ -1,7 +1,5 @@
include_directories (${CMAKE_SOURCE_DIR}/src
${LUA_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${READLINE_INCLUDE_DIR})
${TASK_INCLUDE_DIRS})
set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
Config.cpp Config.h Context.cpp Context.h Date.cpp Date.h
@ -23,7 +21,7 @@ set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
add_library (task STATIC ${task_SRCS})
add_executable (task_executable main.cpp)
target_link_libraries (task_executable task ${LUA_LIBRARIES} ${PTHREAD_LIBRARY} ${READLINE_LIBRARY})
target_link_libraries (task_executable task ${TASK_LIBRARIES})
set_property (TARGET task_executable PROPERTY OUTPUT_NAME "task")
install (TARGETS task DESTINATION bin)

View file

@ -1,8 +1,105 @@
cmake_minimum_required (VERSION 2.8)
include_directories (${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/test ${LUA_INCLUDE_DIR} ${PTHREAD_INCLUDE_DIR} ${READLINE_INCLUDE_DIR})
include_directories (${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/test
${TASK_INCLUDE_DIRS})
add_custom_target (test ./run_all DEPENDS date.t
add_custom_target (test ./run_all DEPENDS date.t t.t tdb.t duration.t t.benchmark.t text.t
autocomplete.t seq.t record.t att.t stringtable.t
subst.t nibbler.t filt.t cmd.t config.t util.t
color.t list.t path.t file.t grid.t directory.t
rx.t taskmod.t lisp.t rectangle.t sensor.t tree.t
tree2.t uri.t
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
add_executable (date.t date.t.cpp test.cpp)
target_link_libraries (date.t task ${LUA_LIBRARIES} ${READLINE_LIBRARY})
target_link_libraries (date.t task ${TASK_LIBRARIES})
add_executable (t.t t.t.cpp test.cpp)
target_link_libraries (t.t task ${TASK_LIBRARIES})
add_executable (tdb.t tdb.t.cpp test.cpp)
target_link_libraries (tdb.t task ${TASK_LIBRARIES})
add_executable (duration.t duration.t.cpp test.cpp)
target_link_libraries (duration.t task ${TASK_LIBRARIES})
add_executable (t.benchmark.t t.benchmark.t.cpp test.cpp)
target_link_libraries (t.benchmark.t task ${TASK_LIBRARIES})
add_executable (text.t text.t.cpp test.cpp)
target_link_libraries (text.t task ${TASK_LIBRARIES})
add_executable (autocomplete.t autocomplete.t.cpp test.cpp)
target_link_libraries (autocomplete.t task ${TASK_LIBRARIES})
add_executable (seq.t seq.t.cpp test.cpp)
target_link_libraries (seq.t task ${TASK_LIBRARIES})
add_executable (record.t record.t.cpp test.cpp)
target_link_libraries (record.t task ${TASK_LIBRARIES})
add_executable (att.t att.t.cpp test.cpp)
target_link_libraries (att.t task ${TASK_LIBRARIES})
add_executable (stringtable.t stringtable.t.cpp test.cpp)
target_link_libraries (stringtable.t task ${TASK_LIBRARIES})
add_executable (subst.t subst.t.cpp test.cpp)
target_link_libraries (subst.t task ${TASK_LIBRARIES})
add_executable (nibbler.t nibbler.t.cpp test.cpp)
target_link_libraries (nibbler.t task ${TASK_LIBRARIES})
add_executable (filt.t filt.t.cpp test.cpp)
target_link_libraries (filt.t task ${TASK_LIBRARIES})
add_executable (cmd.t cmd.t.cpp test.cpp)
target_link_libraries (cmd.t task ${TASK_LIBRARIES})
add_executable (config.t config.t.cpp test.cpp)
target_link_libraries (config.t task ${TASK_LIBRARIES})
add_executable (util.t util.t.cpp test.cpp)
target_link_libraries (util.t task ${TASK_LIBRARIES})
add_executable (color.t color.t.cpp test.cpp)
target_link_libraries (color.t task ${TASK_LIBRARIES})
add_executable (list.t list.t.cpp test.cpp)
target_link_libraries (list.t task ${TASK_LIBRARIES})
add_executable (path.t path.t.cpp test.cpp)
target_link_libraries (path.t task ${TASK_LIBRARIES})
add_executable (file.t file.t.cpp test.cpp)
target_link_libraries (file.t task ${TASK_LIBRARIES})
add_executable (grid.t grid.t.cpp test.cpp)
target_link_libraries (grid.t task ${TASK_LIBRARIES})
add_executable (directory.t directory.t.cpp test.cpp)
target_link_libraries (directory.t task ${TASK_LIBRARIES})
add_executable (rx.t rx.t.cpp test.cpp)
target_link_libraries (rx.t task ${TASK_LIBRARIES})
add_executable (taskmod.t taskmod.t.cpp test.cpp)
target_link_libraries (taskmod.t task ${TASK_LIBRARIES})
add_executable (lisp.t lisp.t.cpp test.cpp)
target_link_libraries (lisp.t task ${TASK_LIBRARIES})
add_executable (rectangle.t rectangle.t.cpp test.cpp)
target_link_libraries (rectangle.t task ${TASK_LIBRARIES})
add_executable (sensor.t sensor.t.cpp test.cpp)
target_link_libraries (sensor.t task ${TASK_LIBRARIES})
add_executable (tree.t tree.t.cpp test.cpp)
target_link_libraries (tree.t task ${TASK_LIBRARIES})
add_executable (tree2.t tree2.t.cpp test.cpp)
target_link_libraries (tree2.t task ${TASK_LIBRARIES})
add_executable (uri.t uri.t.cpp test.cpp)
target_link_libraries (uri.t task ${TASK_LIBRARIES})