使用cmake配置清单工具选项

时间:2018-04-24 15:18:03

标签: c++ visual-studio cmake

是否可以使用cmake或某些脚本配置DPI Awareness值?  add a __copy__ method to your object

3 个答案:

答案 0 :(得分:0)

在CMake中没有内部清单支持,但您可以使用它,此网站上有几个提示(例如,使用清单的人,例如因为UAC等)。

关于DPI,搜索SO上的其他主题,例如here

答案 1 :(得分:0)

我发现这很有帮助。使用cmake应用清单。

https://gist.github.com/bjornblissing/6fc452fe7ec1fdfe3419

答案 2 :(得分:0)

创建一个包含以下内容的清单文件(.manifest 很重要):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:application>
    <asmv3:windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process

然后使用以下命令将其添加到 CMake 中的二进制目标:

target_sources(your-binary PRIVATE path-to-the-file-above.manifest)

您需要 CMake 3.4 或更新版本,请参阅 https://cmake.org/cmake/help/v3.4/release/3.4.html#other