diff --git a/README.md b/README.md index 58159bb..c15d6c0 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ This package automatically injects libhal cmake utility functions: ### `libhal_test_and_make_library()` Builds and tests a library. This function must be used in place of using -libhal_unit_test and libhal_make_library separately. +`libhal_unit_test` and `libhal_make_library` separately. ```cmake libhal_test_and_make_library([LIBRARY_NAME ] @@ -122,13 +122,17 @@ libhal_test_and_make_library([LIBRARY_NAME ] - `PACKAGES` list of packages to automatically find and make available for the package build. - `LINK_LIBRARIES` list of the libraries to link into the library. +- `TEST_PACKAGES` list of test packages to automatically find and make available + for the package build. +- `TEST_LINK_LIBRARIES` list of the libraries to link into the unit tests. These + libraries will be added to the library target. This function requires that Boost.UT unit testing framework to be available as a package. In conan, add this to your `build_requirements()` method: ```python def build_requirements(self): - self.tool_requires("libhal-cmake-util/1.1.0") + self.tool_requires("libhal-cmake-util/2.1.0") self.test_requires("boost-ext-ut/1.1.9") ``` diff --git a/cmake/build.cmake b/cmake/build.cmake index d54dec3..3c7e318 100644 --- a/cmake/build.cmake +++ b/cmake/build.cmake @@ -162,7 +162,14 @@ endfunction() function(libhal_test_and_make_library) set(options) set(one_value_args LIBRARY_NAME) - set(multi_value_args SOURCES TEST_SOURCES INCLUDES PACKAGES LINK_LIBRARIES) + set(multi_value_args + SOURCES + TEST_SOURCES + INCLUDES + PACKAGES + LINK_LIBRARIES + TEST_PACKAGES + TEST_LINK_LIBRARIES) cmake_parse_arguments(BUILD_ARGS "${options}" "${one_value_args}" @@ -173,8 +180,12 @@ function(libhal_test_and_make_library) libhal_unit_test( SOURCES ${BUILD_ARGS_SOURCES} ${BUILD_ARGS_TEST_SOURCES} INCLUDES ${BUILD_ARGS_INCLUDES} - PACKAGES ${BUILD_ARGS_PACKAGES} - LINK_LIBRARIES ${BUILD_ARGS_LINK_LIBRARIES} + PACKAGES + ${BUILD_ARGS_PACKAGES} + ${BUILD_ARGS_TEST_PACKAGES} + LINK_LIBRARIES + ${BUILD_ARGS_LINK_LIBRARIES} + ${BUILD_ARGS_TEST_LINK_LIBRARIES} ) endif()