diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8cf8b5e..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "googletest"] - path = googletest - url = https://github.com/google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 8809b35..e3d8ab5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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 @@ -80,6 +94,7 @@ target_link_libraries(testsuite japi ) +# Include directories target_include_directories(testsuite PUBLIC include/ diff --git a/README.md b/README.md index 58d3c50..5555ee5 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/googletest b/googletest deleted file mode 160000 index 3f5b5b8..0000000 --- a/googletest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f5b5b8f8493a03fa25f1e4a7eae7678514a431d