vs.language.cmake
vs.language.cmake copied to clipboard
Wrong precompiled header files usage during single file build on Windows
Issue Type: Bug
Add such line shown below to CMakeLists.txt on root level (top level file):
# Generate compile_commands.json files so "Compile Active File" button provided by CMake extension works as expected
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
When you use it on Windows with Visual C++ 2019 it fails with mesage shown below (but on linux it works ok):
error C2859: P:\Mesh.SaaS\out\build\x64-windows\TARGET_COMPILE_PDB.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.
Extension version: 0.0.17 VS Code version: Code 1.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:41:52.311Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No
This seems to be a bug in Cmake, see https://gitlab.kitware.com/cmake/cmake/-/issues/25214