Skip to content

Commit cc45a6a

Browse files
committed
cmake: warn on stale SOURCEMETA_CXX_CLANG_TIDY in macOS build cache
Address cubic/augment reviewer feedback on #2467: the prior commit only set `SOURCEMETA_CXX_CLANG_TIDY` in the cache when it was unset, so an existing build directory whose cache already pointed at a real clang-tidy binary would silently bypass the carve-out and keep hitting the Xcode 16 `arm_neon.h` parser error on incremental builds. Emit a `CMake WARNING` in that situation directing the developer to either `cmake --fresh` or pass `-DSOURCEMETA_CXX_CLANG_TIDY=/usr/bin/true` explicitly. Fresh CI configures hit the original `NOT SOURCEMETA_CXX_CLANG_TIDY` branch and get the intended no-op behaviour as before. Signed-off-by: SouptikH <haldersouptik@gmail.com>
1 parent 03b4920 commit cc45a6a

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,18 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
1111
# bumps its bundled clang or PyPI clang-tidy back-supports clang-17.
1212
# Override with `-DSOURCEMETA_CXX_CLANG_TIDY=<path-to-clang-tidy>` to
1313
# re-enable manually once the toolchain mismatch is resolved.
14-
if(APPLE AND NOT SOURCEMETA_CXX_CLANG_TIDY)
15-
set(SOURCEMETA_CXX_CLANG_TIDY "/usr/bin/true"
16-
CACHE STRING "CXX_CLANG_TIDY")
14+
if(APPLE)
15+
if(NOT SOURCEMETA_CXX_CLANG_TIDY)
16+
set(SOURCEMETA_CXX_CLANG_TIDY "/usr/bin/true"
17+
CACHE STRING "CXX_CLANG_TIDY")
18+
elseif(NOT SOURCEMETA_CXX_CLANG_TIDY STREQUAL "/usr/bin/true")
19+
message(WARNING
20+
"SOURCEMETA_CXX_CLANG_TIDY is set to '${SOURCEMETA_CXX_CLANG_TIDY}' "
21+
"in the CMake cache. macOS clang-tidy is known-broken against "
22+
"Xcode 16's arm_neon.h (parser version skew). If the build fails "
23+
"with clang-tidy errors from arm_neon.h, run `cmake --fresh ...` "
24+
"or pass `-DSOURCEMETA_CXX_CLANG_TIDY=/usr/bin/true` explicitly.")
25+
endif()
1726
endif()
1827

1928
# Options

0 commit comments

Comments
 (0)