From 14e1dcd14e73a699c94bdd883c34104daed0404a Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 26 Jan 2021 17:00:34 +0100 Subject: [HICN-677] Add support for unit testing across all subprojects Signed-off-by: Mauro Sardara Change-Id: I7fa6442f53860fe8dcda3c17b63cfca15aa26c63 Signed-off-by: Mauro Sardara --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'CMakeLists.txt') 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}) -- cgit 1.2.3-korg