cmake: FindBluelib now specifies inter-module dependencies for module interface targets
This commit is contained in:
@@ -95,6 +95,7 @@ find_package_handle_standard_args(Bluelib
|
|||||||
REQUIRED_VARS ${required_vars})
|
REQUIRED_VARS ${required_vars})
|
||||||
|
|
||||||
if (Bluelib_FOUND)
|
if (Bluelib_FOUND)
|
||||||
|
set(created_targets)
|
||||||
foreach (component ${components})
|
foreach (component ${components})
|
||||||
string(TOLOWER ${component} header_name)
|
string(TOLOWER ${component} header_name)
|
||||||
set(lib_name ${header_name}${_lib_suffix})
|
set(lib_name ${header_name}${_lib_suffix})
|
||||||
@@ -108,6 +109,45 @@ if (Bluelib_FOUND)
|
|||||||
set_target_properties(Bluelib::${component} PROPERTIES
|
set_target_properties(Bluelib::${component} PROPERTIES
|
||||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
IMPORTED_LOCATION "${Bluelib_${component}_LIBRARY}")
|
IMPORTED_LOCATION "${Bluelib_${component}_LIBRARY}")
|
||||||
|
set(created_targets ${created_targets} ${component})
|
||||||
|
endif ()
|
||||||
|
endforeach (component)
|
||||||
|
|
||||||
|
foreach (component ${created_targets})
|
||||||
|
if ("${component}" STREQUAL "Object")
|
||||||
|
if (NOT TARGET Bluelib::Core)
|
||||||
|
message(FATAL_ERROR "Bluelib: Module 'Object' depends on 'Core', which was not specified in find_package()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_link_libraries(Bluelib::Object INTERFACE Bluelib::Core)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if ("${component}" STREQUAL "Term")
|
||||||
|
if (NOT TARGET Bluelib::Core)
|
||||||
|
message(FATAL_ERROR "Bluelib: Module 'Term' depends on 'Core', which was not specified in find_package()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT TARGET Bluelib::Object)
|
||||||
|
message(FATAL_ERROR "Bluelib: Module 'Term' depends on 'Object', which was not specified in find_package()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_link_libraries(Bluelib::Term 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()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT TARGET Bluelib::Object)
|
||||||
|
message(FATAL_ERROR "Bluelib: Module 'Cmd' depends on 'Object', which was not specified in find_package()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT TARGET Bluelib::Term)
|
||||||
|
message(FATAL_ERROR "Bluelib: Module 'Cmd' depends on 'Term', which was not specified in find_package()")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_link_libraries(Bluelib::Cmd INTERFACE Bluelib::Core Bluelib::Object Bluelib::Term)
|
||||||
endif ()
|
endif ()
|
||||||
endforeach (component)
|
endforeach (component)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user