From: "flichtenheld (Code Review)" Date: Wed, 7 May 2025 11:04:34 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <1818de32870496d04d88fafb595a720fb2208958-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="eBwLp5V1xMQ="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: CMake: Make sure to treat UNIT_TEST_SOURCEDIR as path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --eBwLp5V1xMQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/981?usp=3Demail to review the following change. Change subject: CMake: Make sure to treat UNIT_TEST_SOURCEDIR as path ...................................................................... CMake: Make sure to treat UNIT_TEST_SOURCEDIR as path This makes sure that it is properly normalized, and on Windows seems to prevent CMake from using back slashes which would break the build due to "unknown escape sequence" errors. Change-Id: I2551edfaaf5107649398a3fa1db2009ee8644671 Signed-off-by: Frank Lichtenheld --- M CMakeLists.txt 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/81/981/1 diff --git a/CMakeLists.txt b/CMakeLists.txt index a8fb64b..6687b56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -679,11 +679,11 @@ endif () foreach (test_name ${unit_tests}) + cmake_path(SET _UT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/un= it_tests/openvpn) # test_networking needs special environment if (NOT ${test_name} STREQUAL "test_networking") add_test(${test_name} ${test_name}) # for compat with autotools make check - set(_UT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/unit_test= s/openvpn) set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "srcdir=3D${_UT_SOURCE_DIR}") endif () @@ -703,7 +703,7 @@ # for compat with IDEs like Clion that ignore the tests properties # for the environment variable srcdir when running tests as fallba= ck - target_compile_definitions(${test_name} PRIVATE "-DUNIT_TEST_SOURC= EDIR=3D\"${CMAKE_SOURCE_DIR}/tests/unit_tests/openvpn\"") + target_compile_definitions(${test_name} PRIVATE "UNIT_TEST_SOURCED= IR=3D\"${_UT_SOURCE_DIR}\"") if (NOT ${test_name} STREQUAL "test_buffer") target_sources(${test_name} PRIVATE -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/981?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: I2551edfaaf5107649398a3fa1db2009ee8644671 Gerrit-Change-Number: 981 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --eBwLp5V1xMQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

CMake: Make sure to treat UNIT_TEST_SOURCEDIR as path

= This makes sure that it is properly normalized, and
on Windows seems to = prevent CMake from using back
slashes which would break the build due to= "unknown escape
sequence" errors.

Change-Id: I2551edfa= af5107649398a3fa1db2009ee8644671
Signed-off-by: Frank Lichtenheld <fr= ank@...2641...>
---
M CMakeLists.txt
1 file changed, 2 insertio= ns(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/ope=
nvpn refs/changes/81/981/1
diff --git a/CMakeLists.txt b/CMakeLists=
.txt
index a8fb64b..6687b56 100644
--- a/CM= akeLists.txt
+++ b/CMakeLists.txt
@@ -679,1= 1 +679,11 @@
endif ()

foreach (test_name ${unit_tests})
+ cmake_path(SET _UT_SOURCE_DIR ${CMAKE_CURRENT_= SOURCE_DIR}/tests/unit_tests/openvpn)
# test_netwo= rking needs special environment
if (NOT ${test_nam= e} STREQUAL "test_networking")
add_t= est(${test_name} ${test_name})
# for compat wi= th autotools make check
- set(_UT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests/unit_tes= ts/openvpn)
set_tests_properties(${test_name} = PROPERTIES
ENVIRONMENT "srcdir=3D${_U= T_SOURCE_DIR}")
endif ()
@@ -= 703,7 +703,7 @@

# for compat wit= h IDEs like Clion that ignore the tests properties
= # for the environment variable srcdir when running tests as fallback
- target_compile_defi= nitions(${test_name} PRIVATE "-DUNIT_TEST_SOURCEDIR=3D\"${CMAKE_S= OURCE_DIR}/tests/unit_tests/openvpn\"")
+ target_compile_definitions(${test_nam= e} PRIVATE "UNIT_TEST_SOURCEDIR=3D\"${_UT_SOURCE_DIR}\""= ;)

if (NOT ${test_name} STREQUAL= "test_buffer")
target_sources(${tes= t_name} PRIVATE

To view, visit change 981. = To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2551edfaaf5107649398a3fa1db= 2009ee8644671
Gerrit-Change-Number: 981
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--eBwLp5V1xMQ=--