summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-18 20:01:59 (GMT)
committerBrad King <brad.king@kitware.com>2019-02-18 22:12:14 (GMT)
commit890bae524c6b97d29ffcc3fe5a6a30235d800348 (patch)
tree2e4e04c90e3ced680511c1065ae5b0d75eee9683 /Modules
parent5c171ca898f92e07cb68dd7fa77d0a993b08cc9c (diff)
downloadCMake-890bae524c6b97d29ffcc3fe5a6a30235d800348.zip
CMake-890bae524c6b97d29ffcc3fe5a6a30235d800348.tar.gz
CMake-890bae524c6b97d29ffcc3fe5a6a30235d800348.tar.bz2
Do not explicitly report "standard" include directories as implicit
In commit 1293ed8507 (ParseImplicitIncludeInfo: keep implicit incl. consistent when rerunning cmake, 2019-01-30, v3.14.0-rc1~26^2) we did not account for `CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES`. This variable lets platform modules or toolchain files specify directories that are to be explicitly passed as standard include directories. These include directories are used by the test project from which we extract implicit include directories so they appear in the parsed results whether or not the compiler really considers them implicit. Exclude these entries from the computed implicit include directories since they are not actually implied by the compiler when we invoke it with "standard" include directories passed explicitly. Instead teach the build system generators to treat the "standard" directories as implicit for purposes of excluding them from appearing earlier in the compiler command line due to `include_directories` and `target_include_directories` calls. Issue: #18936, #18944
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index fd1d5fb..e0d2449 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -96,6 +96,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Parsed ${lang} implicit include dir info from above output: rv=${rv}\n${log}\n\n")
if("${rv}" STREQUAL "done")
+ # Entries that we have been told to explicitly pass as standard include
+ # directories will not be implicitly added by the compiler.
+ if(CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES)
+ list(REMOVE_ITEM implicit_incdirs ${CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES})
+ endif()
+
# We parsed implicit include directories, so override the default initializer.
set(_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT "${implicit_incdirs}")
endif()