summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file/LOCK-error-timeout.cmake
blob: b6b9476034e350b549d1700a662a6e87417df8e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
set(script "${CMAKE_CURRENT_LIST_DIR}/timeout-script.cmake")
set(file_to_lock "${CMAKE_CURRENT_BINARY_DIR}/file-to-lock")

file(LOCK "${file_to_lock}")
execute_process(
    COMMAND "${CMAKE_COMMAND}" "-Dfile_to_lock=${file_to_lock}" -P "${script}"
    RESULT_VARIABLE result
    OUTPUT_VARIABLE output
    ERROR_VARIABLE error
)

message("Output: ${output}")
message("Error: ${error}")

if(NOT result EQUAL 0)
  message(FATAL_ERROR "Result: ${result}")
endif()