From c8ac0ceb493c03af3edbcb008503b001bcba50be Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 16 Apr 2024 13:30:16 -0400 Subject: [PATCH] cmake: + xo_self_headeronly_dependency() --- cmake/xo_macros/xo_cxx.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/xo_macros/xo_cxx.cmake b/cmake/xo_macros/xo_cxx.cmake index e63762f8..3fcf3e2f 100644 --- a/cmake/xo_macros/xo_cxx.cmake +++ b/cmake/xo_macros/xo_cxx.cmake @@ -736,6 +736,19 @@ macro(xo_self_dependency target dep) target_link_libraries(${target} PUBLIC ${dep}) endmacro() +# dependency on target provided from this codebase. +# +# Similar comments as for xo_self_dependency() +# 1. don't need find_package() in this case, since details of dep targets +# must be known to cmake for it to build them. +# 2. in any case, can't use find_package() when cmake runs, +# because supporting .cmake files haven't been generated yet +# 3. need to use INTERFACE instead of PUBLIC for a header-only dep +# +macro(xo_self_headeronly_dependency target dep) + target_link_libraries(${target} INTERFACE ${dep}) +endmacro() + # ---------------------------------------------------------------- # need this when linking pybind11-generated libraries #