2015-02-13 19:00:14 +01:00
|
|
|
if (BUILD_TESTS)
|
|
|
|
|
2015-11-26 20:25:09 +01:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/cli/)
|
|
|
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml)
|
2016-08-06 18:21:54 +02:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
2015-02-13 19:00:14 +01:00
|
|
|
|
|
|
|
file(GLOB hdrs "*.h")
|
|
|
|
file(GLOB srcs "*.cpp")
|
|
|
|
|
2016-08-06 18:21:54 +02:00
|
|
|
add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
2015-11-26 20:25:09 +01:00
|
|
|
if (HAVE_RULES)
|
2016-02-19 21:40:31 +01:00
|
|
|
target_link_libraries(testrunner pcre)
|
2015-11-26 20:25:09 +01:00
|
|
|
endif()
|
2015-02-13 19:00:14 +01:00
|
|
|
|
|
|
|
add_custom_target(copy_cfg ALL
|
|
|
|
COMMENT "Copying cfg files")
|
|
|
|
add_custom_command(
|
|
|
|
TARGET copy_cfg
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/cfg"
|
|
|
|
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cfg")
|
|
|
|
|
2019-07-09 07:46:53 +02:00
|
|
|
if (WIN32 AND NOT BORLAND)
|
|
|
|
target_link_libraries(testrunner Shlwapi.lib)
|
|
|
|
endif()
|
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
add_dependencies(testrunner copy_cfg)
|
|
|
|
|
2015-11-26 21:01:07 +01:00
|
|
|
add_test(NAME testrunner COMMAND testrunner WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
|
|
|
2018-11-05 18:13:04 +01:00
|
|
|
add_custom_target(check COMMAND $<TARGET_FILE:testrunner> -q WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
|
|
add_dependencies(check testrunner)
|
|
|
|
|
2015-02-13 19:00:14 +01:00
|
|
|
endif()
|