diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..76472bf --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/Unity"] + path = external/Unity + url = https://github.com/ThrowTheSwitch/Unity.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d02a58..9ad826f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ project(ZBBSServer set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(TARGET_GROUP production CACHE STRING "Group to build") + # Uncomment if you need to use PostgresQL option(USE_POSTGRESQL "Use PostgreSQL instead of SQLite" OFF) @@ -38,6 +40,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_subdirectory(src) +if(TARGET_GROUP STREQUAL test) + include(CTest) + + add_subdirectory(external) + add_subdirectory(test) +endif() + install( TARGETS zbbs-server ) \ No newline at end of file diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt new file mode 100644 index 0000000..0917251 --- /dev/null +++ b/external/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(Unity STATIC + Unity/src/unity.c +) + +target_include_directories(Unity PUBLIC + Unity/src +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..74826c6 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(file_p) \ No newline at end of file diff --git a/test/file_p/CMakeLists.txt b/test/file_p/CMakeLists.txt new file mode 100644 index 0000000..0bd5e20 --- /dev/null +++ b/test/file_p/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(file_p_app + file_p.c +) + +target_link_libraries(file_p_app + file_p + Unity +) + +add_test(file_p_test file_p_app) diff --git a/test/file_p/file_p.c b/test/file_p/file_p.c new file mode 100644 index 0000000..ba98c9f --- /dev/null +++ b/test/file_p/file_p.c @@ -0,0 +1 @@ +#include \ No newline at end of file