summaryrefslogtreecommitdiffstats
path: root/Tests/CTestTestTimeout/CMakeLists.txt
blob: 476d0a5e0bbb71e48b24075254e73d6ed0d9287a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cmake_minimum_required (VERSION 2.8)
project(CTestTestTimeout)
include(CTest)

if(NOT TIMEOUT)
  if(CYGWIN)
    set(TIMEOUT 4) # Cygwin CMake sometimes takes > 1 second to load!
  else()
    set(TIMEOUT 1)
  endif()
endif()

add_definitions(-DTIMEOUT=${TIMEOUT})
add_executable (Timeout timeout.c)

add_test(NAME TestTimeout
  COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
                           -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
                           -P ${CMAKE_CURRENT_SOURCE_DIR}/timeout.cmake
  )
set_tests_properties(TestTimeout PROPERTIES TIMEOUT ${TIMEOUT})

add_test(NAME CheckChild
  COMMAND ${CMAKE_COMMAND} -D Timeout=$<TARGET_FILE:Timeout>
                           -D Log=${CMAKE_CURRENT_BINARY_DIR}/timeout.log
                           -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
  )
set_tests_properties(CheckChild PROPERTIES DEPENDS TestTimeout)