use cmake to generate pdb


Thanks. Note that this is largely an English-speaking forum and other languages are a best-effort and depends on who is available.

In the interest of at least getting something, here is Google Translate’s take:

I think putting those set commands in the top-level scope should be sufficient. Is there a reason that using the RelWithDebInfo build type is not suitable?

I always make sure to build a PDB because than otherwise visual studio’s profiling capabilities are limited. Now that stripped PDBs exist I don’t really see a reason to not create a PDB by default even for release builds.

So I have the following code before I define any targets.

    # Debug Information Format
    # This is only really necessary for the Release configuration
    # Explanation: Without this flag you won't get good profiling information in Release builds
    # Use of /Zi doesn't affect optimizations
    # Because we have a stripped PDB that we release to the public we should always specify this option
    # for our internal PDBs

That sounds like a feature request to CMake to change its default flags to me.

I don’t think the intent of this post is asking for cmake to change anything. Just how to always generate the PDB. I just gave an explanation of my workflow, to try and guess a similar intent.

Usually after the sln file is generated, we use vs to generate the dll and lib files. What I mean is that the configuration type of the project I compiled is a utility, and it is impossible to set and generate a pdb file in VS. Therefore, I would like to ask whether my goal can be achieved through cmake commands.
So far, I have searched the Internet and tried the following commands:
But I don’t know where this command should be placed in which cmakelists, and whether it will really work.Thank you for your help.

Sorry for not using English, I will correct it

Placing it in the top-level CMakeLists.txt should be sufficient.