我有一个用 Cmake 编译的项目。我使用 Gcov 来了解在目标上执行期间的代码覆盖率。 我使用 GCOV_PREFIX 来更改 .gcda 文件的目录。 但是我在这个目录中只有 45 个 .gcda 文件,其余的在源文件夹和子文件夹中。 (600)。
如何将所有 .gcda 文件放在同一个目录中?
最佳答案
问题来自环境变量。我会将环境变量设置为用户并以管理员身份启动程序(sudo)。 解决方案:
- 以管理员身份声明变量
以用户身份启动程序
./开始
使用 -E 选项以管理员身份启动程序
sudo -E ./start
这是手册页中的引用:
-E, --preserve-env Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment.
关于c++ - 使用 Cmake 移动 .gcda 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54889394/