From: tweenk Date: Sun, 11 Jan 2009 21:21:20 +0000 (+0000) Subject: UseGlibMarshal.cmake - Don't overwrite the file if it hasn't changed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a26770f4e44e664c0f531b059a045a894c0b0e74;p=inkscape.git UseGlibMarshal.cmake - Don't overwrite the file if it hasn't changed --- diff --git a/CMakeScripts/UseGlibMarshal.cmake b/CMakeScripts/UseGlibMarshal.cmake index 6f81730e5..63d501a57 100644 --- a/CMakeScripts/UseGlibMarshal.cmake +++ b/CMakeScripts/UseGlibMarshal.cmake @@ -21,8 +21,16 @@ MACRO(GLIB_MARSHAL GLIB_MARSHAL_PREFIX GLIB_MARSHAL_FILE GLIB_MARSHAL_OUTPUT_LOC EXECUTE_PROCESS(COMMAND ${GLIB_MARSHAL_EXECUTABLE} --prefix=${GLIB_MARSHAL_PREFIX} --body ${CMAKE_CURRENT_SOURCE_DIR}/${GLIB_MARSHAL_FILE}.list OUTPUT_VARIABLE GLIB_MARSHAL_OUTPUT_CPP ) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.h "${GLIB_MARSHAL_OUTPUT_HEADER}") - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.cpp "${GLIB_MARSHAL_OUTPUT_EXTRA_LINE}") - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.cpp "${GLIB_MARSHAL_OUTPUT_CPP}") - ENDIF(GLIB_MARSHAL_EXECUTABLE) -ENDMACRO(GLIB_MARSHAL) + # check whether the generated file is the same as the existing one + FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.h GLIB_MARSHAL_HEADER_OLD) + IF(NOT GLIB_MARSHAL_HEADER_OLD STREQUAL GLIB_MARSHAL_OUTPUT_HEADER) + MESSAGE(STATUS "${GLIB_MARSHAL_FILE}.h changed; overwriting") + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.h "${GLIB_MARSHAL_OUTPUT_HEADER}") + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.cpp "${GLIB_MARSHAL_OUTPUT_EXTRA_LINE}") + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${GLIB_MARSHAL_FILE}.cpp "${GLIB_MARSHAL_OUTPUT_CPP}") + ELSE() + MESSAGE(STATUS "${GLIB_MARSHAL_FILE}.h unchanged") + ENDIF() + ENDIF() +ENDMACRO() +