From 34e417a70650ab38325409dd33bf1408e3616098 Mon Sep 17 00:00:00 2001 From: Laurynas Biveinis Date: Mon, 13 Jan 2025 07:13:13 +0200 Subject: [PATCH] Make an example of including UnoDB as a CMake subdirectory - Update UnoDB CMakeLists.txt to use GSL, Google Test, & Google Benchmark CMake targets if they are already set up by parent CMake. - Convert examples/CMakeLists.txt to be a top-level CMake script, showing an example of using UnoDB as a dependency. - Update CI to build examples from the top-level script. --- .circleci/config.yml | 94 ++++++++++++++++++++++++----- .github/workflows/build.yml | 79 +++++++++++++++++++++--- .github/workflows/old-compilers.yml | 53 ++++++++++++++-- .github/workflows/ubuntu-20.04.yml | 53 ++++++++++++++-- .gitignore | 1 + CMakeLists.txt | 71 ++++++++++++---------- README.md | 26 ++++---- examples/CMakeLists.txt | 36 +++++++---- test/CMakeLists.txt | 8 ++- 9 files changed, 326 insertions(+), 95 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 49bdfd85..8f4c0b3e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,9 +23,6 @@ jobs: resource_class: arm.medium steps: - checkout - - run: - name: Checkout submodules - command: git submodule update --init - run: name: Installing dependencies (common) command: | @@ -70,6 +67,57 @@ jobs: - run: name: Create build environment command: mkdir build + - when: + condition: + not: + or: + - << parameters.asan >> + - << parameters.tsan >> + - << parameters.ubsan >> + steps: + - run: + name: Create build environment (examples) + command: mkdir build/build-examples + - run: + name: Installing dependencies (examples) + command: | + sudo apt-get install -y libmsgsl-dev libgtest-dev \ + libbenchmark-dev + - run: + name: Configure CMake (examples) + working_directory: build/build-examples + command: | + readonly BUILD_TYPE=<< parameters.build_type >> + readonly COMPILER=<< parameters.compiler >> + if [[ $COMPILER == "gcc" ]]; then + V=13 + export CC=gcc-$V + export CXX=g++-$V + EXTRA_CMAKE_ARGS=() + elif [[ $COMPILER == "clang" ]]; then + V=19 + export CC=clang-$V + export CXX=clang++-$V + if [[ $BUILD_TYPE == "Release" ]]; then + EXTRA_CMAKE_ARGS=(\ + "-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-$V" \ + "-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-$V" \ + "-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-$V") + else + EXTRA_CMAKE_ARGS=() + fi + EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \ + "-DCLANG_TIDY_EXE=/usr/bin/clang-tidy-$V") + fi + cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + "${EXTRA_CMAKE_ARGS[@]}" + - run: + name: Examples + working_directory: build/build-examples + command: make -j2 examples + - run: + name: Checkout submodules + command: git submodule update --init - run: name: Configure CMake working_directory: build @@ -107,10 +155,6 @@ jobs: name: Build working_directory: build command: make -j2 - - run: - name: Examples - working_directory: build - command: make examples - run: name: Correctness test working_directory: build @@ -160,9 +204,6 @@ jobs: resource_class: macos.m1.medium.gen1 steps: - checkout - - run: - name: Checkout submodules - command: git submodule update --init --recursive - run: name: Install dependencies command: | @@ -171,6 +212,35 @@ jobs: - run: name: Create build environment command: mkdir build + - when: + condition: + not: + or: + - << parameters.asan >> + - << parameters.tsan >> + - << parameters.ubsan >> + steps: + - run: + name: Create build environment (examples) + command: mkdir build/build-examples + - run: + name: Installing dependencies (examples) + command: brew install cpp-gsl googletest google-benchmark + - run: + name: Configure CMake (examples) + working_directory: build/build-examples + command: | + readonly BUILD_TYPE=<< parameters.build_type >> + export CC=clang + export CXX=clang++ + cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - run: + name: Examples + working_directory: build/build-examples + command: make -j3 examples + - run: + name: Checkout submodules + command: git submodule update --init --recursive - run: name: Configure CMake working_directory: build @@ -188,10 +258,6 @@ jobs: name: Build working_directory: build command: make -j3 - - run: - name: Examples - working_directory: build - command: make examples - run: name: Correctness test working_directory: build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94ae12c8..b972b551 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -286,7 +286,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: false - name: Setup common dependencies for Linux run: | @@ -340,6 +340,13 @@ jobs: sudo cpanm install JSON if: runner.os == 'Linux' && env.COVERAGE == 'ON' + - name: Set up dependencies for Linux (examples) + run: sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON' + && runner.os == 'Linux' && env.COVERAGE != 'ON' + - name: Set up dependencies for macOS (common) run: | brew install boost include-what-you-use python-setuptools @@ -349,8 +356,71 @@ jobs: run: brew install cppcheck if: runner.os == 'macOS' && env.CPPCHECK == 'ON' + - name: Set up dependencies for macOS (examples) + run: brew install cpp-gsl googletest google-benchmark + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON' + && runner.os == 'macOS' && env.COVERAGE != 'ON' + - name: Create build environment - run: mkdir ${{github.workspace}}/build + run: | + mkdir ${{github.workspace}}/build \ + ${{github.workspace}}/build/build-examples + + - name: Configure CMake (examples) + # Use a bash shell so we can use the same syntax for environment + # variable access regardless of the host operating system + shell: bash + working-directory: ${{github.workspace}}/build/build-examples + run: | + COMPILER="${COMPILER:-$DEFAULT_COMPILER}" + AVX2="${AVX2:-$DEFAULT_AVX2}" + export PATH="$HOME/.local/bin:$PATH" + if [[ -n "$BUILD_TYPE" ]]; then + CBT="-DCMAKE_BUILD_TYPE=$BUILD_TYPE" + else + CBT="" + fi + if [[ $COMPILER == "gcc" ]]; then + V=13 + EXTRA_CMAKE_ARGS=() + export CC=gcc-$V + export CXX=g++-$V + elif [[ $COMPILER == "clang" ]]; then + V=19 + export CC=clang-$V + export CXX=clang++-$V + if [[ $BUILD_TYPE == "Release" ]]; then + EXTRA_CMAKE_ARGS=(\ + "-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-$V" \ + "-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-$V" \ + "-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-$V") + else + EXTRA_CMAKE_ARGS=() + fi + elif [[ $COMPILER == "macos-clang" ]]; then + export CC=clang + export CXX=clang++ + fi + cmake "$GITHUB_WORKSPACE" "$CBT" "-DAVX2=${AVX2}" \ + "${EXTRA_CMAKE_ARGS[@]}" + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON' + && env.COVERAGE != 'ON' + + - name: Examples + working-directory: ${{github.workspace}}/build/build-examples + run: make -j3 examples + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON' + && env.COVERAGE != 'ON' + + - uses: actions/checkout@v4 + with: + submodules: true - name: Configure CMake # Use a bash shell so we can use the same syntax for environment @@ -426,11 +496,6 @@ jobs: --force-analyze-debug-code make -j3; if: env.STATIC_ANALYSIS == 'ON' && env.COMPILER == 'clang' - - name: Examples - working-directory: ${{github.workspace}}/build - run: make examples - if: env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON' - - name: Correctness test working-directory: ${{github.workspace}}/build run: ctest -j3 -V diff --git a/.github/workflows/old-compilers.yml b/.github/workflows/old-compilers.yml index 1232820c..23e82e99 100644 --- a/.github/workflows/old-compilers.yml +++ b/.github/workflows/old-compilers.yml @@ -446,7 +446,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: false - name: Setup common dependencies run: | @@ -485,8 +485,53 @@ jobs: sudo apt-get install -y gcc if: env.COMPILER == 'gcc' && env.VERSION == '11' + - name: Set up dependencies for examples + run: sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + - name: Create build environment - run: mkdir ${{github.workspace}}/build + run: | + mkdir ${{github.workspace}}/build \ + ${{github.workspace}}/build/build-examples + + - name: Configure CMake (examples) + # Use a bash shell so we can use the same syntax for environment + # variable access regardless of the host operating system + shell: bash + working-directory: ${{github.workspace}}/build-examples + run: | + export PATH=$HOME/.local/bin:$PATH + if [[ $COMPILER == "gcc" ]]; then + export CC="gcc-${VERSION}" + export CXX="g++-${VERSION}" + else + export CC="clang-${VERSION}" + export CXX="clang++-${VERSION}" + if [[ $BUILD_TYPE == "Release" ]]; then + EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \ + "-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-${VERSION}" \ + "-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-${VERSION}" \ + "-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-${VERSION}") + fi + fi + cmake "$GITHUB_WORKSPACE" "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \ + "${EXTRA_CMAKE_ARGS[@]}" + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + + - name: Examples + working-directory: ${{github.workspace}}/build/build-examples + run: make -j3 examples + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + + - uses: actions/checkout@v4 + with: + submodules: true - name: Configure CMake # Use a bash shell so we can use the same syntax for environment @@ -530,10 +575,6 @@ jobs: working-directory: ${{github.workspace}}/build run: make -j3 - - name: Examples - working-directory: ${{github.workspace}}/build - run: make examples - - name: Correctness test working-directory: ${{github.workspace}}/build run: ctest -j3 -V diff --git a/.github/workflows/ubuntu-20.04.yml b/.github/workflows/ubuntu-20.04.yml index 63aa22ec..7a302a1c 100644 --- a/.github/workflows/ubuntu-20.04.yml +++ b/.github/workflows/ubuntu-20.04.yml @@ -172,7 +172,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: false - name: Setup common dependencies run: | @@ -195,8 +195,53 @@ jobs: "lld-${VERSION}" if: env.COMPILER == 'clang' && env.BUILD_TYPE == 'Release' + - name: Set up dependencies for examples + run: sudo apt-get install -y libmsgsl-dev libgtest-dev libbenchmark-dev + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + - name: Create build environment - run: mkdir ${{github.workspace}}/build + run: | + mkdir ${{github.workspace}}/build \ + ${{github.workspace}}/build/build-examples + + - name: Configure CMake (examples) + # Use a bash shell so we can use the same syntax for environment + # variable access regardless of the host operating system + shell: bash + working-directory: ${{github.workspace}}/build-examples + run: | + export PATH=$HOME/.local/bin:$PATH + if [[ $COMPILER == "gcc" ]]; then + export CC="gcc-${VERSION}" + export CXX="g++-${VERSION}" + else + export CC="clang-${VERSION}" + export CXX="clang++-${VERSION}" + if [[ $BUILD_TYPE == "Release" ]]; then + EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \ + "-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-${VERSION}" \ + "-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-${VERSION}" \ + "-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-${VERSION}") + fi + fi + cmake "$GITHUB_WORKSPACE" "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \ + "${EXTRA_CMAKE_ARGS[@]}" + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + + - name: Examples + working-directory: ${{github.workspace}}/build/build-examples + run: make -j3 examples + if: > + env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' + && env.SANITIZE_UB != 'ON' + + - uses: actions/checkout@v4 + with: + submodules: true - name: Configure CMake # Use a bash shell so we can use the same syntax for environment @@ -232,10 +277,6 @@ jobs: working-directory: ${{github.workspace}}/build run: make -j3 - - name: Examples - working-directory: ${{github.workspace}}/build - run: make examples - - name: Correctness test working-directory: ${{github.workspace}}/build run: ctest -j3 -V diff --git a/.gitignore b/.gitignore index 0ea34614..6edf4b4c 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ # MSVC /.vs /out +/examples/compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f5c6a8a..647509bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,7 +345,9 @@ else() set(USE_BOOST_STACKTRACE OFF) endif() -add_subdirectory(3rd_party/GSL) +if (NOT TARGET Microsoft.GSL::GSL) + add_subdirectory(3rd_party/GSL) +endif() string(REPLACE ";" " " CXX_FLAGS_FOR_SUBDIR_STR "${SANITIZER_CXX_FLAGS}") if(MSVC) @@ -379,36 +381,41 @@ macro(RESTORE_CXX_FLAGS_FOR_SUBDIR) set(CMAKE_SHARED_LINKER_FLAGS ${ORIG_CMAKE_SHARED_LINKER_FLAGS}) endmacro() -# For Windows: Prevent overriding the parent project's compiler/linker settings -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +if(NOT TARGET GTest::gtest) + # For Windows: Prevent overriding the parent project's compiler/linker + # settings + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -ADD_CXX_FLAGS_FOR_SUBDIR() -add_subdirectory(3rd_party/googletest) -RESTORE_CXX_FLAGS_FOR_SUBDIR() + ADD_CXX_FLAGS_FOR_SUBDIR() + add_subdirectory(3rd_party/googletest) + RESTORE_CXX_FLAGS_FOR_SUBDIR() +endif() -set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Suppressing Google Benchmark tests" - FORCE) -set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL - "Suppressing Google Benchmark installation" FORCE) +if(NOT TARGET benchmark::benchmark) + set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL + "Suppressing Google Benchmark tests" FORCE) + set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL + "Suppressing Google Benchmark installation" FORCE) -if(IPO_SUPPORTED) - if(is_debug) - # It seems that Google Benchmark does not support multi-configuration - # generators if LTO is enabled - message(STATUS "Disabling LTO for Google Benchmark due to debug build") - elseif(is_apple_clang) - message(STATUS - "Disabling LTO for Google Benchmark because Apple clang is not supported") - else() - set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enabling LTO for Google Benchmark" - FORCE) - message(STATUS "Enabling LTO for Google Benchmark") + if(IPO_SUPPORTED) + if(is_debug) + # It seems that Google Benchmark does not support multi-configuration + # generators if LTO is enabled + message(STATUS "Disabling LTO for Google Benchmark due to debug build") + elseif(is_apple_clang) + message(STATUS + "Disabling LTO for Google Benchmark because Apple clang is not supported") + else() + set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enabling LTO for Google Benchmark" + FORCE) + message(STATUS "Enabling LTO for Google Benchmark") + endif() endif() -endif() -ADD_CXX_FLAGS_FOR_SUBDIR() -add_subdirectory(3rd_party/benchmark) -RESTORE_CXX_FLAGS_FOR_SUBDIR() + ADD_CXX_FLAGS_FOR_SUBDIR() + add_subdirectory(3rd_party/benchmark) + RESTORE_CXX_FLAGS_FOR_SUBDIR() +endif() # Do not build DeepState: # - under Windows as it's not supported @@ -502,8 +509,10 @@ set(is_standalone "$") set(is_gxx_not_release_standalone $) -target_compile_definitions(benchmark PUBLIC - "$<${is_gxx_not_release_standalone}:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>") +if(NOT TARGET benchmark::benchmark) + target_compile_definitions(benchmark PUBLIC + "$<${is_gxx_not_release_standalone}:_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC>") +endif() # Add benchmark_include_dirs by target_include_directories(... SYSTEM ...) # before target_link_libraries so that benchmark headers are included through @@ -608,7 +617,7 @@ function(COMMON_TARGET_PROPERTIES TARGET) cmake_parse_arguments(PARSE_ARGV 1 CTP "SKIP_CHECKS" "" "") target_compile_features(${TARGET} PUBLIC cxx_std_17) set_target_properties(${TARGET} PROPERTIES CXX_EXTENSIONS OFF) - target_compile_definitions(${TARGET} PRIVATE + target_compile_definitions(${TARGET} PUBLIC "$<${is_standalone}:UNODB_DETAIL_STANDALONE>" "$<${use_boost_stacktrace}:UNODB_DETAIL_BOOST_STACKTRACE>" "$<${with_stats}:UNODB_DETAIL_WITH_STATS>" @@ -726,8 +735,7 @@ endif() set(VALGRIND_COMMAND "valgrind" "--error-exitcode=1" "--leak-check=full" "--trace-children=yes" "-v") -add_custom_target(valgrind - DEPENDS valgrind_tests valgrind_benchmarks valgrind_examples) +add_custom_target(valgrind DEPENDS valgrind_tests valgrind_benchmarks) enable_testing() @@ -745,7 +753,6 @@ function(add_sanitized_test) endfunction() add_subdirectory(benchmark) -add_subdirectory(examples) if(TARGET deepstate) add_subdirectory(fuzz_deepstate) add_dependencies(valgrind valgrind_deepstate) diff --git a/README.md b/README.md index e63fdd1f..df070043 100644 --- a/README.md +++ b/README.md @@ -36,20 +36,23 @@ platform-specific features: * Earliest versions of supported compilers: GCC 10, LLVM 11, XCode 16.1, MSVC 2022. Open an issue if you require support for an older version. -* CMake, at least 3.12 +* CMake, at least 3.16 * Boost library. If building with statistics counters, then it is a mandatory dependency for Boost.Accumulator. It is also an optional dependency for Boost.Stacktrace. -### Build dependencies, bundled as git submodules +### Build dependencies, bundled as optional git submodules + +These dependencies are bundled as git submodules but can alternatively be +provided by the parent project: * Guidelines Support Library for `gsl::span`. * Google Test for tests. * Google Benchmark for microbenchmarks. -* [DeepState][deepstate] for fuzzing tests. ### Optional dependencies for development +* [DeepState][deepstate] for fuzzing tests. * clang-format * lcov * clang-tidy @@ -61,19 +64,14 @@ platform-specific features: ## Building -Out-of-source builds are recommended. Before anything else, do - -``` bash -# --recursive is not strictly required at the moment, but a good habit to have -git submodule update --init --recursive -``` - -There are some CMake options for users: +Out-of-source builds are recommended. There are some CMake options for users: * `-DSTANDALONE=OFF` if you are building this as a part of another project, `ON` - if you work on UnoDB itself. It will enable extra global debug checks that - require entire programs to be compiled with them. Currently, this consists of - the libstdc++ debug mode. The default is `OFF`. + if you work on UnoDB itself. In this case, the vendored development + dependencies must be present, i.e. `git submodule update --init --recursive`. + It will enable extra global debug checks that require entire programs to be + compiled with them. Currently, this consists of the libstdc++ debug mode. The + default is `OFF`. * `-DSPINLOCK_LOOP=PAUSE|EMPTY` to choose the spinlock wait loop body implementation for the optimistic lock. `EMPTY` may benchmark better as long as there are fewer threads than available CPU cores. `PAUSE` will use that diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6e37fcab..a6226d75 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,25 +1,35 @@ -# Copyright 2024 Laurynas Biveinis +# Copyright 2024-2025 Laurynas Biveinis +cmake_minimum_required(VERSION 3.16) + +# This is a top-level CMake script and not an include of ../CMakeLists.txt. In +# fact, this one includes the one in the parent directory to show how another +# project can integrate UnoDB in its build. + +project(unodb-examples VERSION 0.1 + DESCRIPTION "unodb key-value store library examples" + HOMEPAGE_URL "https://github.com/laurynas-biveinis/unodb" LANGUAGES CXX) + +# An example of the parent setting up GSL, Google Test, & Google Benchmark and +# providing them for UnoDB to use + +find_package(Microsoft.GSL) +find_package(GTest REQUIRED) +find_package(benchmark REQUIRED) + +# After the above packages have been found, setup UnoDB itself +add_subdirectory(.. unodb) add_executable(example_art example_art.cpp) -common_target_properties(example_art) target_link_libraries(example_art PRIVATE unodb) add_executable(example_art_stats example_art_stats.cpp) -common_target_properties(example_art_stats) target_link_libraries(example_art_stats PRIVATE unodb) add_executable(example_olc_art example_olc_art.cpp) -common_target_properties(example_olc_art) target_link_libraries(example_olc_art PRIVATE unodb) add_custom_target(examples - env ${SANITIZER_ENV} ./example_art - COMMAND env ${SANITIZER_ENV} ./example_art_stats - COMMAND env ${SANITIZER_ENV} ./example_olc_art - DEPENDS example_art example_art_stats example_olc_art) - -add_custom_target(valgrind_examples - COMMAND ${VALGRIND_COMMAND} ./example_art - COMMAND ${VALGRIND_COMMAND} ./example_art_stats - COMMAND ${VALGRIND_COMMAND} ./example_olc_art + env ./example_art + COMMAND env ./example_art_stats + COMMAND env ./example_olc_art DEPENDS example_art example_art_stats example_olc_art) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 189bbf92..8483419e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,20 +26,22 @@ endfunction() add_library(db_test_utils STATIC db_test_utils.hpp db_test_utils.cpp) common_target_properties(db_test_utils) -target_link_libraries(db_test_utils PUBLIC unodb gtest_main gmock_main) +target_link_libraries(db_test_utils + PUBLIC unodb GTest::gtest_main GTest::gmock_main) set_clang_tidy_options(db_test_utils "${DO_CLANG_TIDY}") add_library(qsbr_test_utils STATIC qsbr_test_utils.hpp qsbr_test_utils.cpp qsbr_gtest_utils.hpp qsbr_gtest_utils.cpp) common_target_properties(qsbr_test_utils) -target_link_libraries(qsbr_test_utils PUBLIC gtest_main) +target_link_libraries(qsbr_test_utils PUBLIC GTest::gtest_main) target_link_libraries(qsbr_test_utils PRIVATE unodb_qsbr) set_clang_tidy_options(qsbr_test_utils "${DO_CLANG_TIDY}") function(ADD_TEST_TARGET TARGET) add_executable("${TARGET}" "${TARGET}.cpp") common_target_properties("${TARGET}") - target_link_libraries("${TARGET}" PRIVATE unodb_qsbr unodb_test gtest_main) + target_link_libraries("${TARGET}" + PRIVATE unodb_qsbr unodb_test GTest::gtest_main) set_clang_tidy_options("${TARGET}" "${DO_CLANG_TIDY}") add_sanitized_test(NAME "${TARGET}" COMMAND "${TARGET}") endfunction()