forked from enlightenment/efl
cmake: only update config_headers.h if contents changed.
Generate to a temporary location and avoid touching the original file if it's unchanged. This way we play nicer with build system that regenerate objects based on file timestamps.
This commit is contained in:
parent
fe7a21170c
commit
e36a444c54
|
@ -77,5 +77,19 @@ HEADER_CHECK(libunwind.h HAVE_UNWIND)
|
|||
HEADER_CHECK(mtrace.h HAVE_MTRACE_H)
|
||||
|
||||
function(EFL_HEADER_CHECKS_FINALIZE file)
|
||||
file(WRITE ${file} ${HEADER_FILE_CONTENT})
|
||||
endfunction()
|
||||
file(WRITE ${file}.new ${HEADER_FILE_CONTENT})
|
||||
if (NOT EXISTS ${file})
|
||||
file(RENAME ${file}.new ${file})
|
||||
message(STATUS "${file} was generated.")
|
||||
else()
|
||||
file(MD5 ${file}.new _new_md5)
|
||||
file(MD5 ${file} _old_md5)
|
||||
if(_new_md5 STREQUAL _old_md5)
|
||||
message(STATUS "${file} is unchanged.")
|
||||
else()
|
||||
file(REMOVE ${file})
|
||||
file(RENAME ${file}.new ${file})
|
||||
message(STATUS "${file} was updated.")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
Loading…
Reference in New Issue