[Openvpn-devel] openvpnmsica: link C runtime statically

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

Commit Message

Lev Stipakov June 28, 2023, 10:03 a.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>
---
 src/openvpnmsica/CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

Comments

Frank Lichtenheld July 5, 2023, 11:36 a.m. UTC | #1
On Wed, Jun 28, 2023 at 01:03:50PM +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.

NAK, breaks MinGW build.

Regards,

Patch

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