Skip to content
Snippets Groups Projects
Select Git revision
  • 57934e12344aaa0892af22f0fd74835c5a0e9d20
  • main default protected
  • f-sss4grpc
  • dev
  • 108-implement-rpc-call-for-server-side-scripting
  • f-windows-conan-create
  • f-to-string
  • f-update-requirements
  • f-related-projects
  • f-role
  • f-remote-path
  • f-rel-path
  • f-consol-message
  • v0.3.0
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.2
  • v0.1.1
  • v0.1
  • v0.0.19
  • v0.0.18
  • v0.0.16
  • v0.0.15
  • v0.0.10
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
33 results

.clang-format

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CMakeLists.txt 2.24 KiB
    #
    # This file is a part of the CaosDB Project.
    #
    # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
    # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as
    # published by the Free Software Foundation, either version 3 of the
    # License, or (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with this program. If not, see <https://www.gnu.org/licenses/>.
    #
    
    # append all the test cases here (file name without the ".cpp" suffix)
    set(test_cases
        test_connection
        )
    
    # download gtest library
    include(FetchGTest)
    # add special cmake functions for gtest
    include(GoogleTest)
    
    # disable linting for gtest targets (not our concern)
    set_target_properties(gmock_main gmock gtest gtest_main PROPERTIES
        CXX_CLANG_TIDY ""
        CXX_INCLUDE_WHAT_YOU_USE ""
        EXCLUDE_FROM_ALL 1)
    
    # loop over all test cases and add them to the test runner
    list(LENGTH test_cases len_test_cases)
    math(EXPR len_test_cases "${len_test_cases} - 1")
    foreach (i RANGE "${len_test_cases}")
        list(GET test_cases ${i} test_case_name)
        add_executable(${test_case_name} ${test_case_name}.cpp)
        target_link_libraries(${test_case_name} PRIVATE gtest_main caosdb)
        set_target_properties(${test_case_name} PROPERTIES CXX_CLANG_TIDY "")
        gtest_discover_tests(${test_case_name}
            PROPERTIES
                LABELS "caosdb-cpplib-unit-tests")
    endforeach ()
    
    
    
    # code coverage report
    include(CodeCoverage)
    
    if (LCOV_PATH)
        setup_target_for_coverage_lcov(
            NAME unit_test_coverage
            EXECUTABLE ctest -L caosdb-cpplib-unit-tests
            EXCLUDE "${CMAKE_BINARY_DIR}/*" "g++*"
            DEPEDENCIES caosdb ${test_cases} gtest_main
            LCOV_ARGS --rc lcov_branch_coverage=1
            GENHTML_ARGS --rc lcov_branch_coverage=1
            )
    else ()
        message(WARNING "Could not generate code coverage report. Please install lcov.")
    endif ()