CMake/Tests/RunCMake/file/SIZE.cmake
Wouter Klouwen 12b471e828 file: add SIZE option
This commit adds the SIZE option to file(). It returns the file size of
the given path if it exists and produces an error if not.
2018-11-27 08:50:36 +00:00

10 lines
208 B
CMake

set(file "${CMAKE_CURRENT_BINARY_DIR}/a-test-file")
file(WRITE "${file}" "test")
file(SIZE "${file}" CALCULATED_SIZE)
if (NOT CALCULATED_SIZE EQUAL 4)
message(FATAL_ERROR "Unexpected file size")
endif()