summaryrefslogtreecommitdiff
path: root/expat
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2022-02-23 22:17:35 +0100
committerJohnny Jazeix <jazeix@gmail.com>2022-02-24 22:26:40 +0100
commitf29483773346105da81f73878b5d0832b2d541b8 (patch)
treefa5391fb4e7ef5fcf1126ec557f835f418f341aa /expat
parent65a21f2b2a306d29b44e70264aca948aa0454219 (diff)
downloadlibexpat-git-f29483773346105da81f73878b5d0832b2d541b8.tar.gz
CMake/Windows: store Expat version in the dll
Fixes #555 Tested with msvc2019 and mingw8.1
Diffstat (limited to 'expat')
-rw-r--r--expat/CMakeLists.txt23
-rw-r--r--expat/Makefile.am3
-rw-r--r--expat/win32/expat.iss1
-rw-r--r--expat/win32/version.rc17
4 files changed, 36 insertions, 8 deletions
diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt
index a36b1d06..624771f4 100644
--- a/expat/CMakeLists.txt
+++ b/expat/CMakeLists.txt
@@ -381,7 +381,7 @@ endforeach()
#
# C library
#
-set(expat_SRCS
+set(_EXPAT_C_SOURCES
lib/xmlparse.c
lib/xmlrole.c
lib/xmltok.c
@@ -393,13 +393,18 @@ set(expat_SRCS
if(EXPAT_SHARED_LIBS)
set(_SHARED SHARED)
if(MSVC)
- set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
+ set(_EXPAT_EXTRA_SOURCES ${_EXPAT_EXTRA_SOURCES} lib/libexpat.def)
+ endif()
+ if(WIN32)
+ # Add DLL version
+ string(REPLACE "." "," _EXPAT_DLL_VERSION ${PROJECT_VERSION}.0)
+ set(_EXPAT_EXTRA_SOURCES ${_EXPAT_EXTRA_SOURCES} win32/version.rc)
endif()
else()
set(_SHARED STATIC)
endif()
-add_library(expat ${_SHARED} ${expat_SRCS})
+add_library(expat ${_SHARED} ${_EXPAT_C_SOURCES} ${_EXPAT_EXTRA_SOURCES})
if(_EXPAT_LIBM_FOUND)
target_link_libraries(expat m)
endif()
@@ -434,8 +439,12 @@ target_include_directories(expat
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
-if(NOT EXPAT_SHARED_LIBS AND WIN32)
- target_compile_definitions(expat PUBLIC -DXML_STATIC)
+if(WIN32)
+ if(EXPAT_SHARED_LIBS)
+ target_compile_definitions(expat PRIVATE VER_FILEVERSION=${_EXPAT_DLL_VERSION})
+ else()
+ target_compile_definitions(expat PUBLIC -DXML_STATIC)
+ endif()
endif()
expat_install(TARGETS expat EXPORT expat
@@ -550,7 +559,7 @@ if(EXPAT_BUILD_TESTS)
tests/memcheck.c
tests/minicheck.c
tests/structdata.c
- ${expat_SRCS}
+ ${_EXPAT_C_SOURCES}
)
if(NOT MSVC)
@@ -619,7 +628,7 @@ if(EXPAT_BUILD_FUZZERS)
set(encoding_types UTF-16 UTF-8 ISO-8859-1 US-ASCII UTF-16BE UTF-16LE)
set(fuzz_targets xml_parse_fuzzer xml_parsebuffer_fuzzer)
- add_library(fuzzpat STATIC ${expat_SRCS})
+ add_library(fuzzpat STATIC ${_EXPAT_C_SOURCES})
if(NOT EXPAT_OSSFUZZ_BUILD)
target_compile_options(fuzzpat PRIVATE -fsanitize=fuzzer-no-link)
endif()
diff --git a/expat/Makefile.am b/expat/Makefile.am
index e6e7971e..9fc2e9d5 100644
--- a/expat/Makefile.am
+++ b/expat/Makefile.am
@@ -82,7 +82,8 @@ _EXTRA_DIST_WINDOWS = \
win32/build_expat_iss.bat \
win32/expat.iss \
win32/MANIFEST.txt \
- win32/README.txt
+ win32/README.txt \
+ win32/version.rc
EXTRA_DIST = \
$(_EXTRA_DIST_CMAKE) \
diff --git a/expat/win32/expat.iss b/expat/win32/expat.iss
index 2bbfdab7..e4d82745 100644
--- a/expat/win32/expat.iss
+++ b/expat/win32/expat.iss
@@ -76,6 +76,7 @@ Flags: ignoreversion; Source: doc\*.css; DestDir: "{app}\Doc"
Flags: ignoreversion; Source: doc\*.xml; DestDir: "{app}\Doc"
Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin"
Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin"
+Flags: ignoreversion; Source: win32\version.rc; DestDir: "{app}\Bin"
Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source"
Flags: ignoreversion; Source: AUTHORS; DestDir: "{app}\Source"
Flags: ignoreversion; Source: Changes; DestDir: "{app}\Source"
diff --git a/expat/win32/version.rc b/expat/win32/version.rc
new file mode 100644
index 00000000..64a4dadf
--- /dev/null
+++ b/expat/win32/version.rc
@@ -0,0 +1,17 @@
+1 VERSIONINFO
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_FILEVERSION
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileVersion", "VER_FILEVERSION"
+ VALUE "ProductVersion", "VER_FILEVERSION"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
+ END
+END