diff options
author | Brad King <brad.king@kitware.com> | 2019-02-19 12:53:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-19 12:54:57 (GMT) |
commit | 2dd2079152ceda32a7e5f330f7182fd658716c41 (patch) | |
tree | 685ca9abc7cd2e4a57c0deee93ff07e084d0953c /Modules | |
parent | bc34282da63c3f25c17fee73c97fcc46a0a164ca (diff) | |
parent | 890bae524c6b97d29ffcc3fe5a6a30235d800348 (diff) | |
download | CMake-2dd2079152ceda32a7e5f330f7182fd658716c41.zip CMake-2dd2079152ceda32a7e5f330f7182fd658716c41.tar.gz CMake-2dd2079152ceda32a7e5f330f7182fd658716c41.tar.bz2 |
Merge topic 'fix-legacy-implicit-includes'
890bae524c Do not explicitly report "standard" include directories as implicit
5c171ca898 Restore unconditional use of "standard" include directories
9502276f82 Prefix implicit include directories with sysroot on construction
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2981
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerABI.cmake | 6 | ||||
-rw-r--r-- | Modules/Platform/UnixPaths.cmake | 14 |
2 files changed, 17 insertions, 3 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() diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 46c24bb..97f744d 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -63,21 +63,29 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 ) +if(CMAKE_SYSROOT_COMPILE) + set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}") +else() + set(_cmake_sysroot_compile "${CMAKE_SYSROOT}") +endif() + # Default per-language values. These may be later replaced after # parsing the implicit directory information from compiler output. set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) +unset(_cmake_sysroot_compile) + # Enable use of lib32 and lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) |