macOS: CMAKE_OSX_ARCHITECTURES with > 1 arch & CXX_CLANG_TIDY fails
If I have CMAKE_OSX_ARCHITECTURES
set for universal builds like this:
set( CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" )
And then I turn on CXX_CLANG_TIDY
on a target:
set_target_properties( ${PROJECT_NAME}
PROPERTIES
CXX_CLANG_TIDY "${CLANG_TIDY_PROGRAM}"
)
The build fails with:
error: unable to handle compilation, expected exactly one compiler job in ' ".../bin/clang-tool" "-cc1"...
There are in fact two such ".../bin/clang-tool" "-cc1"
commands - one per architecture.
If I only use one architecture it works and runs clang-tidy correctly.
% cmake --version
cmake version 3.25.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
% clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 15.0.0
Optimized build.
Default target: x86_64-apple-darwin21.6.0
Host CPU: skylake
clang-tidy and CMake both from homebrew on macOS 12.6.2.
(FWIW the similar CXX_CPPCHECK
works fine in both cases.)
Edited by Andy Maloney