[cmake] Avoid modifying `ftconfig.h' and `ftoption.h' files. * CMakeLists.txt: Each time cmake is run those files are modified and the whole FreeType library is recompiled. With this change we change the files only if there are real modifications, so we can avoid recompilations.
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 87a68c0..3b36efe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -215,14 +215,17 @@ if (UNIX)
endif ()
string(REPLACE "/undef " "#undef "
FTCONFIG_H "${FTCONFIG_H}")
- file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h"
+ file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new"
"${FTCONFIG_H}")
else ()
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
FTCONFIG_H)
- file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h"
+ file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new"
"${FTCONFIG_H}")
endif ()
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h-new"
+ "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h")
# Create the options file
@@ -251,8 +254,11 @@ 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"
+file(WRITE "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new"
"${FTOPTION_H}")
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h-new"
+ "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
# Specify library include directories
diff --git a/ChangeLog b/ChangeLog
index 5c9ec13..8b2afe8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-06-09 David Capello <davidcapello@gmail.com>
+
+ [cmake] Avoid modifying `ftconfig.h' and `ftoption.h' files.
+
+ * CMakeLists.txt: Each time cmake is run those files are
+ modified and the whole FreeType library is recompiled. With this
+ change we change the files only if there are real modifications, so
+ we can avoid recompilations.
+
2016-06-09 Werner Lemberg <wl@gnu.org>
[bdf] Check number of properties (#48166).