CMake/Tests/RunCMake/file/LOCK-error-timeout.cmake
Ruslan Baratov e6db4c5a4e file: Add LOCK subcommand to do file and directory locking
Provide options to fail without blocking or to block up to a timeout.
Provide options to specify the scope containing the lock so it can be
released automatically at the end of a function, file, or process.

Extend the RunCMake.file test with cases covering the file(LOCK) command
usage and error cases.
2014-12-03 09:47:44 -05:00

18 lines
461 B
CMake

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()