Skip to content

Commit

Permalink
45 google testframework not optional (#128)
Browse files Browse the repository at this point in the history
Remove googletest as a submodule but download it if required from github
  • Loading branch information
vornkat-iis authored Jul 15, 2024
1 parent 3781d2e commit 90f3f5d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

27 changes: 21 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.14)

project(libjapi VERSION 0.3)
project(libjapi VERSION 0.4)
set(SOVERSION 1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -64,10 +64,24 @@ endif(DOXYGEN_FOUND)

################################
# Create unit test excecutable #

add_subdirectory(googletest/googletest
EXCLUDE_FROM_ALL)

find_package(GTest QUIET)
if(${GTest_FOUND})
# Gtest on System Installed
message("GTest: Installed using GTest")
include(GoogleTest)
else()
# Include GoogleTest in the project
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
endif()

# Define test executable
add_executable(testsuite
EXCLUDE_FROM_ALL
test/japi_test.cc
Expand All @@ -80,6 +94,7 @@ target_link_libraries(testsuite
japi
)

# Include directories
target_include_directories(testsuite
PUBLIC
include/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ A Makefile is generated. Run 'make' to build the libjapi libraries.

A shared and a static library is built.

To run the internal tests run

$ make run_test

## Demo
You can clone the [demo project](https://git01.iis.fhg.de/ks-ip-lib/software/libjapi-demo), with examples for all features from the repository listed below:

Expand Down
1 change: 0 additions & 1 deletion googletest
Submodule googletest deleted from 3f5b5b

0 comments on commit 90f3f5d

Please sign in to comment.