mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 15:19:51 -05:00
Merge topic 'file-size'
12b471e828 file: add SIZE option
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2639
This commit is contained in:
@@ -36,6 +36,8 @@ run_cmake(READ_ELF)
|
||||
run_cmake(GLOB)
|
||||
run_cmake(GLOB_RECURSE)
|
||||
run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS)
|
||||
run_cmake(SIZE)
|
||||
run_cmake(SIZE-error-does-not-exist)
|
||||
|
||||
# tests are valid both for GLOB and GLOB_RECURSE
|
||||
run_cmake(GLOB-sort-dedup)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
^CMake Error at SIZE-error-does-not-exist.cmake:[0-9]+ \(file\):
|
||||
file SIZE requested of path that is not readable
|
||||
/a/file/that/does-not-exist
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
@@ -0,0 +1,3 @@
|
||||
set(file "/a/file/that/does-not-exist")
|
||||
|
||||
file(SIZE "${file}" CALCULATED_SIZE)
|
||||
@@ -0,0 +1,9 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user