[Openvpn-devel,v2] openvpnmsica: link C runtime statically

Message ID 20230705122528.1625-1-lstipakov@gmail.com
State Accepted
Headers show
Series [Openvpn-devel,v2] openvpnmsica: link C runtime statically | expand

Commit Message

Lev Stipakov July 5, 2023, 12:25 p.m. UTC
From: Lev Stipakov <lev@openvpn.net>

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
Signed-off-by: Lev Stipakov <lev@openvpn.net>
---
 v2: fix MinGW build (apply changes to MSVC only)

 src/openvpnmsica/CMakeLists.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Frank Lichtenheld July 5, 2023, 12:51 p.m. UTC | #1
On Wed, Jul 05, 2023 at 03:25:28PM +0300, Lev Stipakov wrote:
> From: Lev Stipakov <lev@openvpn.net>
> 
> 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.

Acked-by: Frank Lichtenheld <frank@lichtenheld.com>

Regards,
Gert Doering July 5, 2023, 4:29 p.m. UTC | #2
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 <lev@openvpn.net>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Message-Id: <20230705122528.1625-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26821.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpnmsica/CMakeLists.txt b/src/openvpnmsica/CMakeLists.txt
index 683d38e0..9126b80f 100644
--- a/src/openvpnmsica/CMakeLists.txt
+++ b/src/openvpnmsica/CMakeLists.txt
@@ -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)