Visual Studio 2022 no longer recognizes symbols from directory specified by CMAKE_INSTALL_PREFIX
I was using Visual Studio 2019, building a C++ CMake project in WSL using VS's Linux development tools. I created by choosing "Open Folder" in VS because I think that was the only available option for CMake projects in VS2019, and maybe it still is?
In my CMakeSettings.json file I have specified a CMAKE_INSTALL_PREFIX, pointing to some directory unrelated to the rest of the project. In Visual Studio 2019, any files in this directory were includable and symbols from them would be recognized by VS. But since I switched to VS2022, any symbol or variable located in a file in the CMAKE_INSTALL_PREFIX directory is now unrecognized with a squiggly red line under it. Same goes for any #include statement attempting to include files from that directory. The solution still builds fine though! It's just the development that is made harder by the fact that I got all these squiggly lines everywhere, and can't F12 my way to any symbols or functions in those files.
Is this an introduced bug in VS2022 or am I doing something wrong? Is there some way to explicitly add a directory to a CMake project without physically copying it to the project directory?