summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/AppleClang-C.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-10-18 14:11:27 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-11-29 14:25:42 (GMT)
commit2c71d051facad13b0a42a57066be2489d5fff6ea (patch)
treed07f850f8abc74d9df34ad885681c08d36c14472 /Modules/Compiler/AppleClang-C.cmake
parentafd0f6785dc1220a07743d31699fcd9097cca46a (diff)
downloadCMake-2c71d051facad13b0a42a57066be2489d5fff6ea.zip
CMake-2c71d051facad13b0a42a57066be2489d5fff6ea.tar.gz
CMake-2c71d051facad13b0a42a57066be2489d5fff6ea.tar.bz2
Makefiles Generators: use compiler for dependencies generation
Each source compilation generates a dependencies file. These dependencies files are consolidated in one file per target. This consolidation is done as part of command 'cmake -E cmake_depends` launched before evaluation of makefile dependency graph. The consolidation uses the same approach as `CMake` dependencies management. Fixes: #21321
Diffstat (limited to 'Modules/Compiler/AppleClang-C.cmake')
-rw-r--r--Modules/Compiler/AppleClang-C.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index 2794f52..02d10d3 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -1,6 +1,18 @@
include(Compiler/Clang)
__compiler_clang(C)
+
+if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
+ AND CMAKE_GENERATOR MATCHES "Makefiles"
+ AND CMAKE_DEPFILE_FLAGS_C)
+ # dependencies are computed by the compiler itself
+ set(CMAKE_C_DEPFILE_FORMAT gcc)
+ set(CMAKE_C_DEPENDS_USE_COMPILER TRUE)
+ endif()
+endif()
+
+
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")