summaryrefslogtreecommitdiffstats
path: root/extras/libmemif/CMakeLists.txt
diff options
context:
space:
mode:
authorDaniel Béreš <dberes@cisco.com>2023-01-19 10:19:27 +0100
committerDave Wallace <dwallacelf@gmail.com>2024-01-12 03:21:41 +0000
commit985334219458c57b569fdbafcfc6b0d117cc48cf (patch)
tree03260d88a35e0af1142becca3409b011c8d9132d /extras/libmemif/CMakeLists.txt
parent56e17cf7a23831b353bc1836def47dad7f869dad (diff)
libmemif: added tests
This patch provides unit tests for libmemif written in Unity Type: test Signed-off-by: Daniel Béreš <dberes@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I19116def6e6d28efd5f460c93911245474a11321
Diffstat (limited to 'extras/libmemif/CMakeLists.txt')
-rw-r--r--extras/libmemif/CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/extras/libmemif/CMakeLists.txt b/extras/libmemif/CMakeLists.txt
index b6b658c2d85..8f057e98f3a 100644
--- a/extras/libmemif/CMakeLists.txt
+++ b/extras/libmemif/CMakeLists.txt
@@ -18,6 +18,35 @@ set(CMAKE_C_STANDARD 11)
include(CheckCCompilerFlag)
include(CheckFunctionExists)
+find_package(Git REQUIRED)
+
+include(ExternalProject)
+set(UNITY unity_project)
+
+ExternalProject_Add(
+ unity_project
+ GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
+ GIT_TAG cf949f45ca6d172a177b00da21310607b97bc7a7
+ PREFIX ${PROJECT_BINARY_DIR}/external/${UNITY}
+ INSTALL_COMMAND cmake --install . --prefix ${PROJECT_BINARY_DIR}
+
+)
+set_source_files_properties(
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/src/unity.c
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/fixture/src/unity_fixture.c
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/memory/src/unity_memory.c
+ PROPERTIES GENERATED TRUE)
+add_library(unity STATIC
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/src/unity.c
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/fixture/src/unity_fixture.c
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/memory/src/unity_memory.c
+)
+target_include_directories(unity PUBLIC
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/src/
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/fixture/src/
+ ${PROJECT_BINARY_DIR}/external/${UNITY}/src/${UNITY}/extras/memory/src/
+)
+add_dependencies(unity unity_project)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
@@ -42,6 +71,9 @@ include_directories(src)
add_subdirectory(src)
add_subdirectory(examples)
+enable_testing()
+include(CTest)
+add_subdirectory(test)
##############################################################################
# Packaging
##############################################################################