[CMake] How to set Windows DLL version information

Anders Backman andersb at cs.umu.se
Thu Jan 29 05:37:59 EST 2009


But I thought the whole idea was to get CMake to handle this?
It states in the documentation that it should be possible. No
exclusion about windows as far as I can see.

I saw this thread before but as CMake claims to have this
functionality (multiplatform) I thought that would be a much better
solution.

Comments?



On Thu, Jan 29, 2009 at 10:09 AM, Hendrik Sattler
<post at hendrik-sattler.de> wrote:
> Anders Backman schrieb:
>> so set_target_properties(target PROPERTIES VERSION 1.1 SOVERSION 1.1)
>>
>> doesnt work under windows then?
>
> No. A RC file is not created automatically. A bit complicated as other
> information is included in that file, too. However, you can use
> configure_file to automatically fill in the information. An example from
> openobex:
> ---------------------------------------------------
> #include <winresrc.h>
>
> VS_VERSION_INFO VERSIONINFO
>  FILEVERSION
> @openobex_VERSION_MAJOR@, at openobex_VERSION_MINOR@, at openobex_VERSION_PATCH@,0
>  PRODUCTVERSION @VERSION_MAJOR@, at VERSION_MINOR@, at VERSION_PATCH@,0
>  FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
> #ifndef NDEBUG
>  FILEFLAGS 0
> #else
>  FILEFLAGS VER_DEBUG
> #endif
>  FILEOS VOS_NT_WINDOWS32
> #ifdef OPENOBEX_EXPORTS
>  FILETYPE VFT_DLL
> #else
>  FILETYPE VFT_STATIC_LIB
> #endif
>  FILESUBTYPE VFT2_UNKNOWN
>  BEGIN
>    BLOCK "StringFileInfo"
>    BEGIN
>      BLOCK "04090000"
>      BEGIN
>        VALUE "FileDescription", "Object Exchange Protocol Implementation"
>        VALUE "FileVersion", "@openobex_VERSION@"
>        VALUE "InternalName", "openobex"
>        VALUE "LegalCopyright", "Licensed under GPLv2 or any later version"
>        VALUE "OriginalFilename", "openobex.dll"
>        VALUE "ProductName", "OpenObex"
>        VALUE "ProductVersion", "@VERSION@"
>      END
>    END
>    BLOCK "VarFileInfo"
>    BEGIN
>      VALUE "Translation", 0x409, 1200
>    END
>  END
> ---------------------------------------------------
>
> Basicly, that defines FileVersion and ProductVersion (which are often
> equal). It works with the MS rc compiler (rc.exe), not tested with
> windres.exe.
> Additionally, you can have a third version information in the VERSION
> flag in a .def file or as compiler argument on the command line. The
> dependency checker tool can show you all three of those version
> information.
>
> CMake could not create this file as e.g. a cmake project() call has no
> version information (why not? it could be the ProductVersion above).
>
> HS
>



--


More information about the CMake mailing list