summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/GNU.cmake
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-11-15 04:39:52 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2012-02-02 23:36:49 (GMT)
commit7eb8d9036c73784f14da9d8381023c1e26df1275 (patch)
tree6d6be598e8850d3bc95a9247cef05a24cfa27de1 /Modules/Compiler/GNU.cmake
parent4468edf12b0b87e32768fcdce7abd30afddcad7b (diff)
downloadCMake-7eb8d9036c73784f14da9d8381023c1e26df1275.zip
CMake-7eb8d9036c73784f14da9d8381023c1e26df1275.tar.gz
CMake-7eb8d9036c73784f14da9d8381023c1e26df1275.tar.bz2
Provide dependency file flags to generator
Causes compiler modules (currently only GNU) to set a CMAKE_DEPFILE_FLAGS_${lang} variable, which communicates to the generator the flags required to cause the compiler to create dependency files.
Diffstat (limited to 'Modules/Compiler/GNU.cmake')
-rw-r--r--Modules/Compiler/GNU.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 8d6f5df..bdcaf9d 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -24,6 +24,15 @@ macro(__compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
+ # Older versions of gcc (< 4.5) contain a bug causing them to report a missing
+ # header file as a warning if depfiles are enabled, causing check_header_file
+ # tests to always succeed. Work around this by disabling dependency tracking
+ # in try_compile mode.
+ GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+ if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
+ set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MF <DEPFILE>")
+ endif()
+
# Initial configuration flags.
set(CMAKE_${lang}_FLAGS_INIT "")
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")