From 863f87db7df9802516ff550f3d5c3d29c15dfd16 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 7 Oct 2023 00:16:07 -0400 Subject: [PATCH] xo-cmake: unwind mistake, revert to INTERFACE for headeronly dep --- cmake/xo_cxx.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmake/xo_cxx.cmake b/cmake/xo_cxx.cmake index 1c323823..150c665f 100644 --- a/cmake/xo_cxx.cmake +++ b/cmake/xo_cxx.cmake @@ -234,12 +234,17 @@ endmacro() # macro(xo_dependency_headeronly target dep) find_package(${dep} CONFIG REQUIRED) - # PUBLIC here is important -- it's needed so that include directories that are required by ${dep}, - # will be included in compilation of ${target}. + # Conflict here between PUBLIC and INTERFACE # - # INTERFACE doesn't make this happen; for a header-only library, it should be supplied to the add_library() macro + # PUBLIC ensures that include directories required by ${dep} will also be included in compilation of ${target}; + # we generally want this # - target_link_libraries(${target} PUBLIC ${dep}) + # INTERFACE mandatory when depending on a header-only library (created with add_library(foo INTERFACE)). + # otherwise get error: + # INTERFACE library can only be used with the INTERFACE keyword of + # target_link_libraries + # + target_link_libraries(${target} INTERFACE ${dep}) endmacro() # dependency on namespaced target