Skip to content
Snippets Groups Projects
CMakeLists.txt 1.64 KiB
Newer Older
Timm Fitschen's avatar
Timm Fitschen committed
#
# 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
    )

Timm Fitschen's avatar
Timm Fitschen committed
find_package(caosdb REQUIRED)
Timm Fitschen's avatar
Timm Fitschen committed
message(STATUS "Found libcaosdb: ${caosdb_DIR}")
Timm Fitschen's avatar
Timm Fitschen committed

include(FetchGTest)
# add special cmake functions for gtest
Timm Fitschen's avatar
Timm Fitschen committed
include(GoogleTest REQUIRED)
Timm Fitschen's avatar
Timm Fitschen committed

# 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::caosdb)
    set_target_properties(${test_case_name} PROPERTIES CXX_CLANG_TIDY "")
    gtest_discover_tests(${test_case_name}
        PROPERTIES
            LABELS "caosdb-cpplib-int-tests")
endforeach ()