diff --git a/CMakeLists.txt b/CMakeLists.txt index c046d0510a364400b0ba09b668c47a9835687d54..96009264576ab2eeab2280c8a049814d48c9bd93 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.13) set(libcaosdb_VERSION 0.0.1) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 241b6a5e7653a8e52439f5ed0752047ec857ed2e..db4db7bd6584f45d0b5018493f41071157328132 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,10 +1,21 @@ -include(FetchCMocka) - # append all the test cases here (file name without the ".c" suffix) set(test_cases test_connection ) +find_library(cmocka-static cmocka) +if (NOT cmocka-static) + message(${cmocka-static}) +elseif (${CMAKE_VERSION} VERSION_LESS "3.14.0") + message(FATAL_ERROR + "Failed to run tests. A pre-installed cmocka could not be found and + your cmake version is prior to 3.14. Please consider to upgrade you + cmake (>=3.14) or install cmocka.") +else () + include(FetchCMocka) +endif () + + list(LENGTH test_cases len_test_cases) math(EXPR len_test_cases "${len_test_cases} - 1") foreach (i RANGE "${len_test_cases}") @@ -15,10 +26,6 @@ foreach (i RANGE "${len_test_cases}") add_test(${test_case_name} ${test_case_name}) endforeach () -#add_executable(test_connection test_connection.c) -#target_compile_features(test_connection PRIVATE c_std_99) -#target_link_libraries(test_connection PRIVATE cmocka-static libcaosdb) -#add_test(test_connection test_connection) # code coverage report include(CodeCoverage)