I am converting some projects to CMake and vcpkg. However when I use Debug or RelWithDebInfo build types the build only copies the .dll files and not the .pdb files from vcpkg.
Here is an example CMakeLists.txt:
cmake_minimum_required(VERSION 3.22)
project(PdbTest)
find_package(fmt CONFIG REQUIRED)
add_executable(Test main.cpp)
target_link_libraries(Test PRIVATE fmt::fmt)
After running:
cmake .. --toolchain C:\Tools\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake --build . --config RelWithDebInfo
Gere are the files generated in <build-dir>\RelWithDebInfo
,
fmt.dll
dos not have a corresponding fmt.pdb
:
25/07/2022 06:54 am 134,144 fmt.dll
25/07/2022 07:04 am 41,984 Test.exe
25/07/2022 07:04 am 1,028,096 Test.pdb
Possible Solution:
I've searched around a bit and I did find an internal vcpkg script that finds the paths of the pdbs from the dlls and copies the pdbs into the vcpkg installed directory when vcpkg builds its libraries:
https://github.com/microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_copy_pdbs.cmake
So I thought I may copy this script and use it for my own CMake builds, it may work if the vcpkg builds occur on the same machine. Probably will need a bit of tinkering to get it to work.
But maybe there is a better way?