cmake/Tests/CTestTestTimeout/CMakeLists.txt

22 lines
644 B
CMake
Raw Normal View History

2024-11-11 15:18:55 +01:00
cmake_minimum_required(VERSION 3.10)
2013-03-16 19:13:01 +02:00
project(CTestTestTimeout)
include(CTest)
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
if(NOT TIMEOUT)
2015-04-27 22:25:09 +02:00
# Give the process time to load and start running.
set(TIMEOUT 4)
2013-03-16 19:13:01 +02:00
endif()
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
add_definitions(-DTIMEOUT=${TIMEOUT})
2015-04-27 22:25:09 +02:00
add_executable (Sleep sleep.c)
2009-10-04 10:30:41 +03:00
2013-03-16 19:13:01 +02:00
add_test(NAME TestTimeout
2015-04-27 22:25:09 +02:00
COMMAND ${CMAKE_COMMAND} -D Sleep=$<TARGET_FILE:Sleep>
2010-03-17 14:00:29 +02:00
-D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
-P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
)
2013-03-16 19:13:01 +02:00
set_tests_properties(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})
2009-10-04 10:30:41 +03:00
2015-04-27 22:25:09 +02:00
add_test(NAME TestSleep COMMAND Sleep)
set_tests_properties(TestSleep PROPERTIES DEPENDS TestTimeout)