From: "plaisthos (Code Review)" Date: Thu, 7 Dec 2023 17:49:41 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="9XHBNYDDQww="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Use mingw compile definition also to unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: openvpn-devel --9XHBNYDDQww= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=3Demail to review the following change. Change subject: Use mingw compile definition also to unit tests ...................................................................... Use mingw compile definition also to unit tests Currently we only apply the defines for windows APIs and Unicode to OpenVPN itself. We should rather treat the unit tests the same as our main binary to reduce potential differences. Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b Signed-off-by: Arne Schwabe --- M CMakeLists.txt 1 file changed, 14 insertions(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/469/1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 577bc5d..8c24cca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -259,6 +259,15 @@ endif () + if (MINGW) + target_compile_options(${target} PRIVATE + -DWIN32_LEAN_AND_MEAN + -DNTDDI_VERSION=3DNTDDI_VISTA -D_WIN32_WINNT=3D_WIN32_WINN= T_VISTA + ) + target_compile_options(${target} PRIVATE -municode -UUNICODE) + target_link_options(${target} PRIVATE -municode) + endif() + # optional dependencies target_link_libraries(${target} PUBLIC $ @@ -514,14 +523,6 @@ add_library_deps(openvpn) -if (MINGW) - target_compile_options(openvpn PRIVATE - -DWIN32_LEAN_AND_MEAN - -DNTDDI_VERSION=3DNTDDI_VISTA -D_WIN32_WINNT=3D_WIN32_WINNT_VISTA - ) - target_compile_options(openvpn PRIVATE -municode -UUNICODE) - target_link_options(openvpn PRIVATE -municode) -endif() if (MSVC) # we have our own manifest @@ -634,6 +635,11 @@ target_include_directories(${test_name} PRIVATE src/openvpn) + if (MINGW) + # when compiling with -municode, mingw looks for wmain instead= of main + target_compile_definitions(${test_name} PRIVATE -Dmain=3Dwmain) + endif () + if (NOT ${test_name} STREQUAL "test_buffer") target_sources(${test_name} PRIVATE src/openvpn/buffer.c -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/469?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614bedb398e85859b Gerrit-Change-Number: 469 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --9XHBNYDDQww= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

Vi= ew Change

Use mingw compile definition also to unit tests

Curren= tly we only apply the defines for windows APIs and Unicode to
OpenVPN it= self. We should rather treat the unit tests the same as
our main binary = to reduce potential differences.

Change-Id: Ie5aa643ab6190262f7c8b9e= 614bedb398e85859b
Signed-off-by: Arne Schwabe <arne@...1227...>---
M CMakeLists.txt
1 file changed, 14 insertions(+), 8 deletions(-= )

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69=
/469/1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 577bc5d..8c24cca 100644
--- a/CMakeLists.txt<= br>+++ b/CMakeLists.txt
@@ -259,6 +259,15 @@
endif ()

+ if (MINGW)
+ target_compile_options(${target} = PRIVATE
+ = -DWIN32_LEAN_AND_MEAN
+ -DNTDDI_VERSION=3DNTDDI_VISTA -D_WIN32_WINNT=3D_WIN32= _WINNT_VISTA
+ = )
+ target_co= mpile_options(${target} PRIVATE -municode -UUNICODE)
+ target_link_options(${target} PRI= VATE -municode)
+ = endif()
+
<= span> # optional dependencies
target_link_librarie= s(${target} PUBLIC
$<TARGET_NAME_IF_EXISTS:PkgC= onfig::liblz4>
@@ -514,14 +523,6 @@

add_library_deps(openvpn)

-if (MINGW)
- target_compile_options(openvpn PRIVATE=
- -DWIN32_LEAN_AND_MEA= N
- -DNTDDI_VERS= ION=3DNTDDI_VISTA -D_WIN32_WINNT=3D_WIN32_WINNT_VISTA
- )
- target_compile_options(openvpn PRIVATE -municode -U= UNICODE)
- target_li= nk_options(openvpn PRIVATE -municode)
-endif()

if (MSVC)=
# we have our own manifest
@@ -634,6 +635,11= @@

target_include_directories($= {test_name} PRIVATE src/openvpn)

+ if (MINGW)
+ # when compiling with -municode, = mingw looks for wmain instead of main
+ target_compile_definitions(${test_name} PRIVA= TE -Dmain=3Dwmain)
+ = endif ()
+
if (NOT ${test_name} STREQUAL "test_buffer"= )
target_sources(${test_name} PRIVATE src/openvpn/buffer.c

To view, visit change 469. To unsubscribe, or for help writing mail filte= rs, visit settings.

<= div itemscope itemtype=3D"http://schema.org/EmailMessage">
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie5aa643ab6190262f7c8b9e614b= edb398e85859b
Gerrit-Change-Number: 469
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--9XHBNYDDQww=--