cmake: update FindBluelib to support serial module

This commit is contained in:
2025-06-27 22:00:26 +01:00
parent 9aa75b4d0b
commit 21f424956e

View File

@@ -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()")