Use cmake compiled dlls in other projects and be able to put breakpoints

Hello community,

I have a cmake project that builds dll compiled debug.
Now I want to use that dll in another cmake project (it cannot be the same as the other one). I have been able to link with it using target_link_libraries and target_include_directories for the dll headers and run the binary. I also see the lib allows me to debug, if I breakpoint on the executable files and go into dll methods with the debugger, but I’m not able to browse dll sources and directly put breakpoints on it.
Is there a correct way, and what would it be, to import the dll created by another cmake project and be able to used it for debugging, browse it’s code and put breakpoints on it?
The solution should cosider dlls compiled in other developpers PCs with source paths that may be in different path.
Is INCLUDE_EXTERNAL_MSPROJECT( ) a valid way to do this?
Thanks in advance

.pdb files are important here. Debuggers typically have ways of saying “reroor source searches from path A to path B”, but I don’t know if the linker has any influence over that. CMake doesn’t have any abstractions beyond setting properties in VS projects at least. Maybe someone else here has an idea, but Stack Overflow may also be useful as it sounds more general than CMake (though once it’s known how to do it at all, asking here how to get CMake to do it would be how I’d go about it).

When debugging into the installed source, the directory for the extra sources can be configured in VS in the solution properties.

The pdb file for each dll should be in the same directory.

If the PDB files are in the same folder as the .dll files (at run-time) then you will be able to set breakpoints. This is independent from seeing sources.

We use something along these lines to install PDBs (if they exist) for our project:

   FILES $<TARGET_PDB_FILE:your_project_name>

The concept of PDB files is windows/msvc specific so you may need to guard this with the necessary conditionals/checks.

Thanks all for your answers,

I think I’m already using the pbd file, because I can debug the dell, but I’m not able to browse dll sources to put the breakpoint, mainly because the “go to definition” is not fully working with all dll sources, I can only browse some definitions. Probably because many of the executable calls, are calls to a base class, inherited in the dlls (sort of plugins)
So, I’m forced to break in the main.cpp, then execute until the correct source code is opened because of the execution, finally put the breakpoint there. I’m looking to an easier way to do this.
If you have any other idea, you are welcome.