summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-01-23 14:33:30 -0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-23 18:23:41 +0100
commite36a444c541d5dd47857321dd55bae5e1bdf51c9 (patch)
tree73c44ead537857e9c2805cf32eae46e1281448b6
parentfe7a21170c5aa568425556c1b33d240bd13bc17c (diff)
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.
-rw-r--r--cmake/helpers/CommonHeaderChecks.cmake18
1 files changed, 16 insertions, 2 deletions
diff --git a/cmake/helpers/CommonHeaderChecks.cmake b/cmake/helpers/CommonHeaderChecks.cmake
index ac7dba8dff..a92dabd9b7 100644
--- a/cmake/helpers/CommonHeaderChecks.cmake
+++ b/cmake/helpers/CommonHeaderChecks.cmake
@@ -77,5 +77,19 @@ HEADER_CHECK(libunwind.h HAVE_UNWIND)
77HEADER_CHECK(mtrace.h HAVE_MTRACE_H) 77HEADER_CHECK(mtrace.h HAVE_MTRACE_H)
78 78
79function(EFL_HEADER_CHECKS_FINALIZE file) 79function(EFL_HEADER_CHECKS_FINALIZE file)
80 file(WRITE ${file} ${HEADER_FILE_CONTENT}) 80 file(WRITE ${file}.new ${HEADER_FILE_CONTENT})
81endfunction() \ No newline at end of file 81 if (NOT EXISTS ${file})
82 file(RENAME ${file}.new ${file})
83 message(STATUS "${file} was generated.")
84 else()
85 file(MD5 ${file}.new _new_md5)
86 file(MD5 ${file} _old_md5)
87 if(_new_md5 STREQUAL _old_md5)
88 message(STATUS "${file} is unchanged.")
89 else()
90 file(REMOVE ${file})
91 file(RENAME ${file}.new ${file})
92 message(STATUS "${file} was updated.")
93 endif()
94 endif()
95endfunction()