[libcxx-commits] [PATCH] D144785: [libc++] Improves clang-tidy configuration.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 26 03:20:04 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG664f345cd53d: [libc++] Improves clang-tidy configuration. (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144785/new/

https://reviews.llvm.org/D144785

Files:
  libcxx/test/tools/clang_tidy_checks/CMakeLists.txt


Index: libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
===================================================================
--- libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -3,7 +3,16 @@
 set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
 set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
 
-find_package(Clang 16...17)
+# The find_package changes these variables. This leaves the build in an odd
+# state. Calling cmake a second time tries to write site config information in
+# the system's libc++. Restoring these setting after testing fixes this issue.
+set(LLVM_DIR_SAVE ${LLVM_DIR})
+set(Clang_DIR_SAVE ${Clang_DIR})
+
+find_package(Clang 16)
+if (NOT Clang_FOUND)
+  find_package(Clang 17)
+endif()
 
 set(SOURCES
     abi_tag_on_virtual.cpp
@@ -21,6 +30,9 @@
   return()
 endif()
 
+set(LLVM_DIR "${LLVM_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for LLVM." FORCE)
+set(Clang_DIR "${Clang_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for Clang." FORCE)
+
 message(STATUS "Found system-installed LLVM ${LLVM_PACKAGE_VERSION} with headers in ${LLVM_INCLUDE_DIRS}")
 
 set(CMAKE_CXX_STANDARD 20)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144785.500540.patch
Type: text/x-patch
Size: 1215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230226/52c78468/attachment.bin>


More information about the libcxx-commits mailing list