From 6d74e7870b8804a5af0bc395a9fbb45c1b3d26a4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 15 Mar 2016 10:15:53 -0400 Subject: [PATCH] Ninja: Add dependencies on system-provided header files (#14914) When system-provided packages are upgraded we must re-compile sources depending on their headers. Use `-MD` instead of `-MMD` so that the generated depfiles do not exclude system headers. Suggested-by: Jussi Judin --- Help/release/dev/ninja-depfile-system-headers.rst | 5 +++++ Modules/Compiler/GNU.cmake | 2 +- Modules/Compiler/Intel-C.cmake | 2 +- Modules/Compiler/Intel-CXX.cmake | 2 +- Modules/Compiler/QCC.cmake | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/ninja-depfile-system-headers.rst diff --git a/Help/release/dev/ninja-depfile-system-headers.rst b/Help/release/dev/ninja-depfile-system-headers.rst new file mode 100644 index 000000000..7033cef6f --- /dev/null +++ b/Help/release/dev/ninja-depfile-system-headers.rst @@ -0,0 +1,5 @@ +ninja-depfile-system-headers +---------------------------- + +* The :generator:`Ninja` generator now includes system header files in build + dependencies to ensure correct re-builds when system packages are updated. diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index d1ca85e3d..c2d393dc8 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -41,7 +41,7 @@ macro(__compiler_gnu lang) # distcc does not transform -o to -MT when invoking the preprocessor # internally, as it ought to. Work around this bug by setting -MT here # even though it isn't strictly necessary. - set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT -MF ") + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT -MF ") endif() # Initial configuration flags. diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index dfba4b2ce..77363eb9c 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -6,7 +6,7 @@ set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_C "-MMD -MT -MF ") +set(CMAKE_DEPFILE_FLAGS_C "-MD -MT -MF ") set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 794769527..02c636cc4 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -6,7 +6,7 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") -set(CMAKE_DEPFILE_FLAGS_CXX "-MMD -MT -MF ") +set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT -MF ") set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake index 76477e4bb..f69c7bda0 100644 --- a/Modules/Compiler/QCC.cmake +++ b/Modules/Compiler/QCC.cmake @@ -20,5 +20,5 @@ macro(__compiler_qcc lang) set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,") - set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,,-MT,,-MF,") + set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MD,,-MT,,-MF,") endmacro()