mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 11:50:11 -05:00
7c516f7e28
Projects may be generating a list of files or directories to pass as arguments to file(TOUCH), file(TOUCH_NOCREATE), or file(MAKE_DIRECTORY). Those lists might end up being empty, so rather than requiring at least one item, allow an empty list. Fixes: #24897
18 lines
449 B
CMake
18 lines
449 B
CMake
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}")
|
|
|
|
# Empty arguments used to be an error, but this is valid since CMake 3.30
|
|
file(TOUCH)
|
|
file(TOUCH_NOCREATE)
|