blob: 31494d507f1b605fc72856c67f0b9eec536e3f50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
if(NOT EXISTS "${generatedFile}")
message(SEND_ERROR "Missing generated file:\n ${generatedFile}")
endif()
if (CMAKE_HOST_UNIX)
find_program(STAT_EXECUTABLE NAMES stat)
if(NOT STAT_EXECUTABLE)
return()
endif()
if (CMAKE_HOST_SYSTEM_NAME MATCHES "FreeBSD")
execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${sourceFile}"
OUTPUT_VARIABLE output1
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(COMMAND "${STAT_EXECUTABLE}" -f %Lp "${generatedFile}"
OUTPUT_VARIABLE output2
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${sourceFile}"
OUTPUT_VARIABLE output1
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(COMMAND "${STAT_EXECUTABLE}" -f %A "${generatedFile}"
OUTPUT_VARIABLE output2
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
else()
execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${sourceFile}"
OUTPUT_VARIABLE output1
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
execute_process(COMMAND "${STAT_EXECUTABLE}" -c %a "${generatedFile}"
OUTPUT_VARIABLE output2
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
endif()
if (NOT output1 EQUAL output2)
message(SEND_ERROR "generated file has a different permissions source "
"permissions: \"${output1}\" generated permissions: \"${output2}\"")
endif()
endif()
|