
When the -p option is given to clang-tidy, it doesn't need the compile command line to be appended. It can get everything it needs from the compile_commands.json file in the directory specified with the -p option. When the compiler being used is not the system default compiler, clang-tidy has been observed to pick up the wrong headers when the compiler command line is given, but not if only the -p option is used. Therefore, don't append the compiler command line if -p is present in the <LANG>_CLANG_TIDY target property. Fixes: #24017
8 lines
234 B
CMake
8 lines
234 B
CMake
enable_language(C)
|
|
|
|
# Include a --checks option to confirm that we don't match options that start
|
|
# with --, only a standalone --
|
|
set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -p ${CMAKE_BINARY_DIR} --checks=*)
|
|
|
|
add_executable(main main.c)
|