aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2021-01-26 17:00:34 +0100
committerMauro Sardara <msardara@cisco.com>2021-01-26 17:25:06 +0100
commit14e1dcd14e73a699c94bdd883c34104daed0404a (patch)
treec6d23f7601e290366feb01e36f5d01e12bfc88df /CMakeLists.txt
parent23b89912e3c1be309e6f61df1f8a5a01c03c8e98 (diff)
[HICN-677] Add support for unit testing across all subprojects
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I7fa6442f53860fe8dcda3c17b63cfca15aa26c63 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27d3b419e..31f40aaa6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ option(BUILD_HICNPLUGIN "Build the hicn vpp plugin" OFF)
option(BUILD_SYSREPOPLUGIN "Build the sysrepo plugin" OFF)
option(BUILD_EXTRAS "Build external projects" OFF)
option(BUILD_TELEMETRY "Build telemetry projects" OFF)
+option(BUILD_TESTS "Build unit tests" OFF)
option(DISABLE_EXECUTABLES "Disable executables" OFF)
if ((BUILD_APPS OR BUILD_UTILS) AND NOT BUILD_LIBTRANSPORT)
@@ -97,6 +98,18 @@ if (NOT WIN32)
add_compile_options(-Wall -Werror -Wno-shorten-64-to-32)
endif ()
+# Add unit tests
+if (BUILD_TESTS)
+ message(STATUS "Tests enabled.")
+ include (GTestImport)
+
+ if(${CMAKE_VERSION} VERSION_GREATER "3.10.0")
+ include (GoogleTest)
+ else()
+ include (CTest)
+ endif()
+endif()
+
message(STATUS "Building the following subprojects: ${subdirs}")
foreach(dir ${subdirs})