diff --git a/cmake/FindBluelib.cmake b/cmake/FindBluelib.cmake index 17a7c60..7e7e3f5 100644 --- a/cmake/FindBluelib.cmake +++ b/cmake/FindBluelib.cmake @@ -49,7 +49,7 @@ if (Bluelib_STATIC) set(_lib_suffix "-s") endif () -set(supported_components Core Object Term Cmd Io) +set(supported_components Core Object Term Cmd Io Serial) set(components ${Bluelib_FIND_COMPONENTS}) string(REPLACE ";" ", " supported_components_string_list "${supported_components}") @@ -138,6 +138,18 @@ if (Bluelib_FOUND) target_link_libraries(Bluelib::Term INTERFACE Bluelib::Core Bluelib::Object) endif () + if ("${component}" STREQUAL "Serial") + if (NOT TARGET Bluelib::Core) + message(FATAL_ERROR "Bluelib: Module 'Serial' depends on 'Core', which was not specified in find_package()") + endif () + + if (NOT TARGET Bluelib::Object) + message(FATAL_ERROR "Bluelib: Module 'Serial' depends on 'Object', which was not specified in find_package()") + endif () + + target_link_libraries(Bluelib::Serial INTERFACE Bluelib::Core Bluelib::Object) + endif () + if ("${component}" STREQUAL "Cmd") if (NOT TARGET Bluelib::Core) message(FATAL_ERROR "Bluelib: Module 'Cmd' depends on 'Core', which was not specified in find_package()")