如何获取cmake为目标安装pdb文件 [英] How to get cmake to install pdb files for targets

查看:1093
本文介绍了如何获取cmake为目标安装pdb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取cmake安装调试Visual Studio生成的dll和exes所需的伴随pdb文件?

How do I get cmake to install the companion pdb files needed to debug Visual Studio generated dlls and exes?

推荐答案

一直在努力得到一个很好的答案这个问题。我现在认为我找到一个:使用安装文件命令与 $< TARGET_PDB_FILE:tgt> 生成器表达式。具体来说,下面的install命令似乎工作。该命令将目标$ {PROJECT_NAME} pdb文件复制到目标的安装目录。

I have struggled for a while trying to get a good answer to this question. I now think I have found one: use an install file command with the $<TARGET_PDB_FILE:tgt> generator expression. Specifically, the install command below seems to work. The command will copy the target ${PROJECT_NAME} pdb file to the target's installation bin directory.

install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)

此命令将为每个配置安装pdb文件生成一个pdb文件。通过使用可选,如果源pdb文件不存在,install命令将不会生成错误。此命令用于使用 add_library($ {PROJECT_NAME} ...) add_executable($ {PROJECT_NAME} ...)创建的目标)命令。

The command will install the pdb file for each configuration that generates a pdb file. By using OPTIONAL the install command will not generate an error if the source pdb file does not exist. This command is meant to be used for targets created with add_library(${PROJECT_NAME} ...) or add_executable(${PROJECT_NAME} ...) commands.

这是我发现的最好的答案。请让我知道如果有一个更好的。我发现在 TARGET_PDB_FILE /latest/manual/cmake-generator-expressions.7.html#informational-expressionsrel =nofollow noreferrer> cmake-generator-expressions 文档。

This is the best answer I have found. Please let me know if there is a better one. I found some difficult to understand documentation of the TARGET_PDB_FILE generator experession at the "Informational Expressions" section of the cmake-generator-expressions documentation.

这篇关于如何获取cmake为目标安装pdb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆