PCH: Debug symbols lost due to REUSE_FROM precompiled header
project(Test LANGUAGES CXX)
add_library(lib lib.cxx)
target_precompile_headers(lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/pch.h)
add_executable(exec exec.cxx)
target_precompile_headers(exec REUSE_FROM lib)
Steps to reproduce:
- Compile configuration Debug using Visual Studio
- Remove output folder Debug where exec.exe is located
- Build again
Output:
exec.obj : warning LNK4205: 'C:\cygwin64\home\daniel.eiband\test\build\Debug\lib.pdb' is missing current debugging information for referencing module; linking object as if no debug info
First of all it is strange, that exec.obj has a link to lib.pdb. I would expect the symbols to be in exec.pdb.
As a result debug symbols for exec.obj are not available and breakpoints in exec.cxx are not hit. I think the reused pdb should only be copied if it is more recent than the compile pdb of the target which reuses it.
Edited by Daniel Eiband