Skip to content

Commit

Permalink
Adding the provided sources to test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
yobeonline committed Apr 2, 2022
1 parent ace166e commit 10994b8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions add_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ function(add_target target_name)
endif()

find_package(Boost REQUIRED COMPONENTS unit_test_framework)
fetch_source_files(sources ${io1_BOOST_TEST})

add_executable(${test_name} ${test_sources})

apply_source_groups(${io1_BOOST_TEST})
apply_source_files_properties(${io1_BOOST_TEST})

target_link_libraries(${test_name} PRIVATE ${target_name} Boost::unit_test_framework)

add_test(
Expand All @@ -101,7 +107,14 @@ function(add_target target_name)
endif()

find_package(GTest REQUIRED)

fetch_source_files(sources ${io1_GOOGLE_TEST})

add_executable(${test_name} ${test_sources})

apply_source_groups(${io1_GOOGLE_TEST})
apply_source_files_properties(${io1_GOOGLE_TEST})

target_link_libraries(${test_name} PRIVATE ${target_name} GTest::Main)

gtest_discover_tests(${test_name}
Expand Down

0 comments on commit 10994b8

Please sign in to comment.