aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorArne Schwabe2024-02-01 15:48:17 +0100
committerGert Doering2024-02-01 18:22:02 +0100
commitbb0849db20747dc4acea394c4db807a47cbc526b (patch)
tree5045a90eb3442128716cc673f4d72991a1535de1 /CMakeLists.txt
parente1f8c599aeb840909f5ea8e9ae0bc4dab5bc7deb (diff)
downloadopenvpn-bb0849db20747dc4acea394c4db807a47cbc526b.zip
openvpn-bb0849db20747dc4acea394c4db807a47cbc526b.tar.gz
Allow unit tests to fall back to hard coded location
Settings the environment variable required for running unit tests is tiresome in my IDE (Clion). So allow unit tests to fall back to a hard coded location in case the environment variable is not set. Change-Id: Ide72b81f497088dd0fd2cdcfff83cbce5b48f145 Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Message-Id: <20240201144817.188884-1-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28161.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be55c60..fdd2b01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -682,6 +682,10 @@ if (BUILD_TESTING)
target_include_directories(${test_name} PRIVATE src/openvpn)
+ # for compat with IDEs like Clion that ignore the tests properties
+ # for the environment variable srcdir when running tests as fallback
+ target_compile_definitions(${test_name} PRIVATE "-DUNIT_TEST_SOURCEDIR=\"${CMAKE_SOURCE_DIR}/tests/unit_tests/openvpn\"")
+
if (NOT ${test_name} STREQUAL "test_buffer")
target_sources(${test_name} PRIVATE
src/openvpn/buffer.c