Windows: dll (built with cmake) will contain proper file version info

master
crusader-mike 2019-09-13 12:46:19 -05:00
parent 3cd06883e0
commit 4da7bb4fec
2 changed files with 70 additions and 8 deletions

View File

@ -1,12 +1,20 @@
add_library(nfs init.c
libnfs.c
libnfs-sync.c
libnfs-zdr.c
nfs_v3.c
nfs_v4.c
pdu.c
socket.c)
set(SOURCES init.c
libnfs.c
libnfs-sync.c
libnfs-zdr.c
nfs_v3.c
nfs_v4.c
pdu.c
socket.c
)
# deal with version info in "dll" case
if(WIN32 AND BUILD_SHARED_LIBS)
configure_file(../win32/version.rc.template version.rc @ONLY)
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
endif()
add_library(nfs ${SOURCES})
target_include_directories(nfs PUBLIC ../include)
target_link_libraries(nfs PUBLIC ${CORE_LIBRARIES} ${SYSTEM_LIBRARIES})
set_target_properties(nfs PROPERTIES

54
win32/version.rc.template Normal file
View File

@ -0,0 +1,54 @@
#include <winver.h>
#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
#define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0\0"
#define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
#define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.0\0"
#define VER_PRIVATEBUILD 0
#define VER_PRERELEASE 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
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "https://github.com/sahlberg/libnfs"
VALUE "FileDescription", "LIBNFS is a client library for accessing NFS shares over a network."
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "libnfs.dll"
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "libnfs.dll"
VALUE "ProductName", "libnfs"
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