cmake/Tests/RunCMake/file/TOUCH.cmake

18 lines
449 B
CMake
Raw Normal View History

2018-08-09 18:06:22 +02:00
set(file "${CMAKE_CURRENT_BINARY_DIR}/file-to-touch")
file(REMOVE "${file}")
file(TOUCH_NOCREATE "${file}")
if(EXISTS "${file}")
message(FATAL_ERROR "error: TOUCH_NOCREATE created a file!")
endif()
file(TOUCH "${file}")
if(NOT EXISTS "${file}")
message(FATAL_ERROR "error: TOUCH did not create a file!")
endif()
file(REMOVE "${file}")
2024-07-09 14:46:46 +02:00
# Empty arguments used to be an error, but this is valid since CMake 3.30
2018-08-09 18:06:22 +02:00
file(TOUCH)
file(TOUCH_NOCREATE)