* CMakeLists.txt: Avoid rewriting of unchanged configuration files. Reported as https://savannah.nongnu.org/patch/index.php?9755
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28dc3b3..e226ce4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,12 +234,20 @@ if (UNIX)
endif ()
string(REPLACE "/undef " "#undef "
FTCONFIG_H "${FTCONFIG_H}")
-else()
+else ()
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
FTCONFIG_H)
endif ()
-file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h"
- "${FTCONFIG_H}")
+
+set(FTCONFIG_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h")
+if (EXISTS "${FTCONFIG_H_NAME}")
+ file(READ "${FTCONFIG_H_NAME}" ORIGINAL_FTCONFIG_H)
+else ()
+ set(ORIGINAL_FTCONFIG_H "")
+endif ()
+if (NOT (ORIGINAL_FTCONFIG_H STREQUAL FTCONFIG_H))
+ file(WRITE "${FTCONFIG_H_NAME}" "${FTCONFIG_H}")
+endif ()
# Create the options file
@@ -265,8 +273,16 @@ if (HARFBUZZ_FOUND)
"/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
-file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h"
- "${FTOPTION_H}")
+
+set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
+if (EXISTS "${FTOPTION_H_NAME}")
+ file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H)
+else ()
+ set(ORIGINAL_FTOPTION_H "")
+endif ()
+if (NOT (ORIGINAL_FTOPTION_H STREQUAL FTOPTION_H))
+ file(WRITE "${FTOPTION_H_NAME}" "${FTOPTION_H}")
+endif ()
file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h")
@@ -333,7 +349,7 @@ endif ()
if (NOT DISABLE_FORCE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX d)
-endif()
+endif ()
add_library(freetype
@@ -456,7 +472,15 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
string(REPLACE "%LIBS_PRIVATE%" "" # All libs support pkg-config
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
- file(WRITE ${PROJECT_BINARY_DIR}/freetype2.pc ${FREETYPE2_PC_IN})
+ set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
+ if (EXISTS "${FREETYPE2_PC_IN_NAME}")
+ file(READ "${FREETYPE2_PC_IN_NAME}" ORIGINAL_FREETYPE2_PC_IN)
+ else ()
+ set(ORIGINAL_FREETYPE2_PC_IN "")
+ endif ()
+ if (NOT (ORIGINAL_FREETYPE2_PC_IN STREQUAL FREETYPE2_PC_IN))
+ file(WRITE "${FREETYPE2_PC_IN_NAME}" ${FREETYPE2_PC_IN})
+ endif ()
install(
FILES ${PROJECT_BINARY_DIR}/freetype2.pc
@@ -493,9 +517,9 @@ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSIO
if (WIN32)
set(CPACK_GENERATOR ZIP)
-else()
+else ()
set(CPACK_GENERATOR TGZ)
-endif()
+endif ()
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
diff --git a/ChangeLog b/ChangeLog
index a977c53..6d12957 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-04-15 Minmin Gong <gongminmin@msn.com>
+
+ * CMakeLists.txt: Avoid rewriting of unchanged configuration files.
+
+ Reported as
+
+ https://savannah.nongnu.org/patch/index.php?9755
+
2019-04-15 JDG <JonathanG@iQmetrix.com>
* src/tools/apinames.c (main): Fix error message.