summaryrefslogtreecommitdiff
path: root/Modules/CMakeParseImplicitIncludeInfo.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-08 10:04:05 -0400
committerBrad King <brad.king@kitware.com>2019-04-08 10:12:22 -0400
commitef41d49812f90f3d2a6edcae282a30b545df7f6d (patch)
treea04a69583bc7905ffd2989cd517639c27ce02249 /Modules/CMakeParseImplicitIncludeInfo.cmake
parent6bc6fc2a7f3fa142779e3b42de8cecfcf9d4ae74 (diff)
downloadcmake-ef41d49812f90f3d2a6edcae282a30b545df7f6d.tar.gz
Fix implicit include directory extraction for adaptive relative paths
In some cases GCC reports *relative* implicit include directories. They are computed adaptively with respect to the current working directory such that the effective implicit include directory is an unchanging absolute path. Teach our implicit include directory extraction to recognize such paths and normalize them. Fixes: #19133
Diffstat (limited to 'Modules/CMakeParseImplicitIncludeInfo.cmake')
-rw-r--r--Modules/CMakeParseImplicitIncludeInfo.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake
index c8d4c5acd9..c42474bf48 100644
--- a/Modules/CMakeParseImplicitIncludeInfo.cmake
+++ b/Modules/CMakeParseImplicitIncludeInfo.cmake
@@ -216,6 +216,14 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var)
get_filename_component(dir "${d}" ABSOLUTE)
list(APPEND implicit_dirs "${dir}")
string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n")
+ elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/](.*)$]])
+ # This relative path is deep enough to get out of the CMakeFiles/CMakeTmp
+ # directory where the ABI check is done. Assume that the compiler has
+ # computed this path adaptively based on the current working directory
+ # such that the effective result is absolute.
+ get_filename_component(dir "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}" ABSOLUTE)
+ list(APPEND implicit_dirs "${dir}")
+ string(APPEND log " collapse relative include dir [${d}] ==> [${dir}]\n")
else()
string(APPEND log " skipping relative include dir [${d}]\n")
endif()