Using CMake clang-tidy support with clang-cl results in 'warning: argument unused during compilation: '-T P''
When using CXX_CLANG_TIDY
and compiling with clang-cl the following warning is reported by clang-cl:
warning: argument unused during compilation: '-T P'
Example Ninja command that results in warning:
[9/28] C:\Users\daan\scoop\apps\cmake\3.12.1\bin\cmake.exe -E __run_co_compile --tidy=C:/Users/daan/scoop/apps/llvm/current/bin/clang-tidy.exe --source=..\src\cpp\reproc.cpp -- C:\Users\daan\scoop\apps\llvm\current\bin\clang-cl.exe -TP -DHAS_ATTRIBUTE_LIST -DNOMINMAX -DREPROC_BUILDING -DVC_EXTRALEAN -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -I..\include\c -I..\src\c\windows -I..\include\cpp /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 /nologo /W3 -Wno-deprecated-declarations -Wno-switch /showIncludes /FoCMakeFiles\reproc.dir\src\cpp\reproc.cpp.obj /FdCMakeFiles\reproc.dir\reproc.pdb -c ..\src\cpp\reproc.cpp
warning: argument unused during compilation: '-T P' [clang-diagnostic-unused-command-line-argument]
If I don't use CXX_CLANG_TIDY
the warning doesn't appear.
CMake adds the -TP compile argument but clang-tidy reports that it isn't used.
To reproduce:
- git clone https://github.com/DaanDeMeyer/reproc
- git checkout 2fb056
- cd reproc
- mkdir build && cd build
- cmake -G Ninja -DREPROC_BUILD_CXX_WRAPPER=ON -DREPROC_TIDY=ON -DCMAKE_CXX_COMPILER=clang-cl.exe -DCMAKE_C_COMPILER=clang-cl.exe ..
- ninja
Software:
- OS: Windows 10
- CMake: 3.12.1
- Clang: 6.0.1
- Ninja: 1.8.2
Edited by Ghost User