GNU: Disable depfiles in try-compile mode only for GCC

Disabling them causes issues for Clang's CUDA frontend.
Since this is a GCC bug, simply check for GCC.
This commit is contained in:
Raul Tambre
2020-03-12 14:00:00 +02:00
committed by Brad King
parent 5f02add366
commit 60e60b9201

View File

@@ -44,7 +44,8 @@ macro(__compiler_gnu lang)
# 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)
if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" AND _IN_TC AND NOT CMAKE_FORCE_DEPFILES)
else()
# 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.