Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- v*
pull_request:

concurrency:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/freebsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: freebsd

on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
name: run test on FreeBSD
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y devel/googletest cmake pkgconf

run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=17 \
-DUNITS_ENABLE_TESTS=ON \
-DUNITS_USE_EXTERNAL_GTEST=ON
cmake --build build -j4
cd build
ctest --output-on-failure
6 changes: 4 additions & 2 deletions config/AddGoogletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ endif()
function(add_unit_test test_source_file)
get_filename_component(test_name "${test_source_file}" NAME_WE)
add_executable("${test_name}" "${test_source_file}")
target_link_libraries("${test_name}" gtest gmock gtest_main)
target_link_libraries("${test_name}" GTest::gtest GTest::gmock GTest::gtest_main)
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
set_target_properties(${test_name} PROPERTIES FOLDER "Tests")
endfunction()

# Target must already exist
macro(add_gtest TESTNAME)
target_link_libraries(${TESTNAME} PUBLIC gtest gmock gtest_main)
target_link_libraries(
${TESTNAME} PUBLIC GTest::gtest GTest::gmock GTest::gtest_main
)

if(GOOGLE_TEST_INDIVIDUAL)
gtest_discover_tests(
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ else()
target_compile_options(test_all_unit_base PRIVATE /wd4459)
endif()
target_link_libraries(
test_all_unit_base gtest gmock gtest_main ${UNITS_LC_PROJECT_NAME}::units
compile_flags_target
test_all_unit_base GTest::gtest GTest::gmock GTest::gtest_main
${UNITS_LC_PROJECT_NAME}::units compile_flags_target
)
set_target_properties(test_all_unit_base PROPERTIES FOLDER "Tests")
# test_all_unit_base should not be added to the tests it will take a long time run
Expand Down
Loading