Reputation: 189
I want to add some version information to exe
when compile
.
On vs2008, I can do it through add->resource->version
steps.
But how can I do it through cmake
?
Upvotes: 5
Views: 4988
Reputation: 871
When using MinGW (GCC for Windows), we use windres like so:
windres foo.rc foores.o
gcc -o foo.exe foo.o foores.o
Refer its documentation here (MinGW)
With Visual Studio, you might use the Resource Compiler. Refer to its documentation here (Microsoft). Resource Files (.rc) are where you will store your version/author information. Refer to the format of the .rc files in Microsoft's documentation linked to above.
A sample .rc files goes something like this:
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Addition Library"
VALUE "CompanyName", "Lithiumheads Inc."
VALUE "FileDescription", "A library to perform addition."
VALUE "FileVersion", "1, 0, 0, 0"
VALUE "InternalName", "Addition"
VALUE "LegalCopyright", "2011 Anurag Chugh"
VALUE "OriginalFilename", "Addition.dll"
VALUE "ProductName", "Addition Library"
VALUE "ProductVersion", "1, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
Upvotes: 4