aboutsummaryrefslogtreecommitdiff
path: root/libc/CMakeLists.txt
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2023-09-19 23:08:29 +0200
committerGitHub <noreply@github.com>2023-09-19 23:08:29 +0200
commita35a3b75b219247eb9ff6784d1a0fe562f72d415 (patch)
treeaffd89ab7c3160dfe48dab031b4c665942f11b6a /libc/CMakeLists.txt
parentbe8c2df2b15b17ef7a409a95333f09b016fc4a7e (diff)
downloadllvm-a35a3b75b219247eb9ff6784d1a0fe562f72d415.zip
llvm-a35a3b75b219247eb9ff6784d1a0fe562f72d415.tar.gz
llvm-a35a3b75b219247eb9ff6784d1a0fe562f72d415.tar.bz2
[libc][cmake] Tidy compiler includes (#66783)
We want to activate `llvm-header-guard` (#66477) but the current CMake configuration includes paths that should be `isystem`. This PR restricts the number of `-I` passed to the clang command line and correctly marks the llvm libc include path as `isystem`.
Diffstat (limited to 'libc/CMakeLists.txt')
-rw-r--r--libc/CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 0cec6fc..414be90 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -7,6 +7,11 @@ endif()
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
NO_POLICY_SCOPE)
+# `llvm-project/llvm/CMakeLists.txt` adds the following directive
+# `include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})`
+# We undo it to be able to precisely control what is getting included.
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
+
# Default to C++17
set(CMAKE_CXX_STANDARD 17)