This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c4e691  Add CTest support (#3)
1c4e691 is described below

commit 1c4e69136ae8eec56082d95fecda062b6eb33341
Author: Masaori Koshiba <[email protected]>
AuthorDate: Fri May 31 01:14:54 2024 +0900

    Add CTest support (#3)
---
 CMakeLists.txt            | 6 ++----
 unit_tests/CMakeLists.txt | 3 ++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9b3771..53fd4e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,14 +6,12 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set(CMAKE_INSTALL_PREFIX ${CMAKE_HOME_DIRECTORY}/image)
 endif ()
 
-cmake_dependent_option(LIBSWOC_TEST
-    "Enable generation of libswoc test targets" ON
-    "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
+include(CTest)
 
 # Fortunately this has no external dependencies so the set up can be simple.
 add_subdirectory(code)
 
-if (LIBSWOC_TEST)
+if (BUILD_TESTING)
     add_subdirectory(unit_tests)
     add_subdirectory(example)
 endif()
diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt
index 02c4a3a..a26ab69 100644
--- a/unit_tests/CMakeLists.txt
+++ b/unit_tests/CMakeLists.txt
@@ -37,6 +37,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
     # stop the compiler from complaining about unused variable in structured 
binding
     if (GCC_VERSION VERSION_LESS 8.0)
         target_compile_options(test_libswoc PRIVATE -Wno-unused-variable)
-    endif ()
+    endif()
 endif()
 
+add_test(NAME test_libswoc COMMAND test_libswoc)

Reply via email to