【发布时间】:2020-07-28 11:40:58
【问题描述】:
我需要将信息添加到我通过 CMake 生成的 C++ DLL 中,而不使用第三方工具。 我尝试将 version.rc 文件添加到我的目录并将其包含在 CMakeLists 文件中,但它似乎没有填充 DLL 信息框上的字段。
CMakeLists:
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_SOURCE_DIR}/version.rc
@ONLY
)
add_library(foo SHARED
${CMAKE_CURRENT_SOURCE_DIR}/version.rc)
)
版本.rc
#define VER_FILEVERSION 3,10,349,0
#define VER_FILEVERSION_STR "3.10.349.0\0"
#define VER_PRODUCTVERSION 3,10,0,0
#define VER_PRODUCTVERSION_STR "3.10\0"
#ifndef DEBUG
#define VER_DEBUG 0
#else
#define VER_DEBUG VS_FF_DEBUG
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
VALUE "Translation", 0x409, 1252
END
END
【问题讨论】:
-
欢迎来到 Stack Overflow。请阅读the help pages,接受SO tour,阅读How to Ask,以及this question checklist。最后请edit你的问题显示minimal reproducible example,在你的情况下是版本资源文件和
CMakeLists.txt文件。 -
这可能是因为您的 dll 没有源文件,也没有可导出的内容。还是示例减少了太多?
-
@drescherjm 示例是超级简化的。 DLL 在环境中按预期导出,只是没有像我预期的那样附加到属性的详细信息。