natvis file is ignored by msbuild
Have a look at the following cmake file:
cmake_minimum_required(VERSION 3.16)
project(Sample LANGUAGES CXX)
add_executable(Sample main.cpp)
target_link_options(Sample PRIVATE /NATVIS:some.natvis)
Try to generate the project with a VS2022 generator ( but it seems like earlier VS versions including VS2017 are affected as well )
Take a look at the generated Sample.vcxproj
. Notice there is a <Link><Natvis>
xml section.
Try to build the project with cmake --build . --config Debug --versbose
and notice that link.exe
lacks /NATVIS:some.natvis
command line argument while the produced Sample.pdb
file lacks natvis data.
For some reason natvis was ignored by msbuild. Not sure if it's a msbuild problem or maybe cmake should put natvis argument in vsxproj <Link><AdditionalOptions>
section or there are some more complex issues here