Skip to contentSkip to conversation

openvpnmsica: link C runtime statically

PATCH Superseded Lev Stipakov 3 participants 5 messages Jun 28, 2023 – Jul 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvpnmsica: link C runtime statically

From: Lev Stipakov <[email protected]...>

By default CMake links C runtime dynamically,
which doesn't work on Windows 7, for example.

This is not an issue with other openvpn binaries, since we bundle C runtime, but it is not yet available during installation.

Change-Id Ib2b014f075908e7db0d9115abaa2240e47fd27b9
---
 src/openvpnmsica/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)
src/openvpnmsica/CMakeLists.txt +3 -0
index 683d38e0..6816b119 100644
@@ -25,7 +25,10 @@ target_compile_options(openvpnmsica PRIVATE
     -D_UNICODE
     -UNTDDI_VERSION
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
+    "$<$<CONFIG:Release>:/MT>"
+    "$<$<CONFIG:Debug>:/MTd>"
     )
+
 target_link_libraries(openvpnmsica
     advapi32.lib ole32.lib msi.lib setupapi.lib iphlpapi.lib shell32.lib shlwapi.lib version.lib newdev.lib)
 if (MINGW)
Signature · 1 line
2.23.0.windows.1
#1 lore raw
Quoted 8 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

By default CMake links C runtime dynamically,
which doesn't work on Windows 7, for example.

This is not an issue with other openvpn binaries, since we bundle C runtime, but it is not yet available during installation.

NAK, breaks MinGW build.

Regards,

Signature · 1 line
  Frank Lichtenheld
#2 lore raw

PATCH v2 1/1 openvpnmsica: link C runtime statically

From: Lev Stipakov <[email protected]...>

By default CMake links C runtime dynamically,
which doesn't work on Windows 7, for example.

This is not an issue with other openvpn binaries, since we bundle C runtime, but it is not yet available during installation.

Change-Id Ib2b014f075908e7db0d9115abaa2240e47fd27b9

---
v2: fix MinGW build (apply changes to MSVC only)

 src/openvpnmsica/CMakeLists.txt | 8 ++++++++
 1 file changed, 8 insertions(+)
src/openvpnmsica/CMakeLists.txt +8 -0
index 683d38e0..9126b80f 100644
@@ -26,6 +26,14 @@ target_compile_options(openvpnmsica PRIVATE
     -UNTDDI_VERSION
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
+
+if (MSVC)
+    target_compile_options(openvpnmsica PRIVATE
+        "$<$<CONFIG:Release>:/MT>"
+        "$<$<CONFIG:Debug>:/MTd>"
+        )
+endif ()
+
 target_link_libraries(openvpnmsica
     advapi32.lib ole32.lib msi.lib setupapi.lib iphlpapi.lib shell32.lib shlwapi.lib version.lib newdev.lib)
 if (MINGW)
Signature · 1 line
2.38.1.windows.1
Acked-by on v2 1/1
#3 lore raw
Quoted 8 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

By default CMake links C runtime dynamically,
which doesn't work on Windows 7, for example.

This is not an issue with other openvpn binaries, since we bundle C runtime, but it is not yet available during installation.

Regards,

Signature · 1 line
  Frank Lichtenheld
#4 lore raw
In reply to Lev Stipakov

Build tested via GHA, which does mingw and MSVC builds.

Not tested actual installers.

Your patch has been applied to the master branch.

commit 3be4986ea3d6e27acd3e3a317c15dfe07688e135 (master)

Author: Lev Stipakov
Date:   Wed Jul 5 15:25:28 2023 +0300
     openvpnmsica: link C runtime statically

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26821.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering