Hi, I want to ask if I should explicitly call the find_package()
and target_link_libraries()
if they are provided by a library through INTERFACE_LINK_LIBRARIES
.
A short explanation of what I mean , I have a shared library
TinyOrm::TinyOrm
that has a public or interface dependencies for eg. Qt::Core
, Qt::Sql
, and range-v3::range-v3
and now I have a project hello::hello
that links against this TinyOrm
library.
Should I link against it like this:
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core Sql)
tiny_find_package(Qt${QT_VERSION_MAJOR} ${minQtVersion} CONFIG
REQUIRED COMPONENTS Core Sql
)
tiny_find_package(range-v3 ${minRangeV3Version} CONFIG REQUIRED)
find_package(TinyOrm 0.1.0 CONFIG REQUIRED)
target_link_libraries(hello
PRIVATE
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Sql
range-v3::range-v3
TinyOrm::TinyOrm
)
Or like this :
find_package(TinyOrm 0.1.0 CONFIG REQUIRED)
target_link_libraries(hello PRIVATE TinyOrm::TinyOrm)
Thank you for advice and suggestion.