clang-tidy on Windows fails to understand external headers with MSVC -imsvc flag when there are space in between
it seems it happens with msvc-cmake project with clang-tidy too. clang-tidy using msvc-cmake also doesn't understand externals.
if i change windows-clang.cmake
, -imsvc
to -imsvc
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc ")
to
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc")
it works fine.
but, i'd rather not adjust cmake file directly myself. i put below code in my project.
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (${CMAKE_INCLUDE_SYSTEM_FLAG_CXX} STREQUAL "-imsvc ") #not fixed yet, current cmake 3.23
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-imsvc")
elseif(${CMAKE_INCLUDE_SYSTEM_FLAG_CXX} STREQUAL "-external:I ") #fixed in cmake 3.23
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-external:I")
endif()
endif()