Skip to content

Commit e80bf80

Browse files
committed
conditionally find unit test framework and link it to tests
1 parent f02ce0f commit e80bf80

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ set(VIAMCPPSDK_XTL_VERSION_MINIMUM 0.7.2)
324324
set(VIAMCPPSDK_XTENSOR_VERSION_MINIMUM 0.24.3)
325325

326326
# Time to find `BOOST`.
327-
find_package(Boost ${VIAMCPPSDK_BOOST_VERSION_MINIMUM} REQUIRED COMPONENTS headers log program_options)
327+
if (VIAMCPPSDK_BUILD_TESTS)
328+
set(VIAMCPPSDK_BOOST_TEST "unit_test_framework")
329+
endif()
330+
331+
find_package(Boost ${VIAMCPPSDK_BOOST_VERSION_MINIMUM} REQUIRED COMPONENTS headers log program_options ${VIAMCPPSDK_BOOST_TEST})
328332

329333
# Time to find `protobuf` and `gRPC[++]`. Normally this would just be
330334
# something like `find_package(gRPC <version> CONFIG REQUIRED)`, and

src/viam/sdk/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ target_include_directories(viamsdk_test
4747

4848
target_link_libraries(viamsdk_test
4949
PUBLIC viam-cpp-sdk::viamsdk
50+
PUBLIC Boost::unit_test_framework
5051
)
5152

5253
viamcppsdk_link_viam_api(viamsdk_test PUBLIC)

0 commit comments

Comments
 (0)