VS: SYSTEM include dirs do not set correct project properties for external headers
With version 3.24 CMake has introduced support for external ("system") headers for the Visual Studio generator by adding the "SYSTEM" flag to the target_include_directories command (see #17904 (closed)) and #18272).
This is achieved by adding custom compile options (-external:I ...). While this works at first glance, it bypasses IDE support for libraries whose include-dirs are added that way. As a consequence, it is not possible to navigate to the library headers. Furthermore browsing symbols of those libraries works only partially.
Visual Studio (2019 & 2022) actually provides a dedicated project property for that purpose: "Project Properties/VC++ Directories/General/External Include Directories" producing XML/vcxproj output like:
VS XML
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ExternalIncludePath>C:/my_libs/lib1/include;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ExternalIncludePath>C:/my_libs/lib1/include;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
(source: MS DOC paragraph "To set this compiler option in the Visual Studio development environment")
Adding include paths to this property allows for IDE-navigation as expected.