From 2dbda84ef1ff5004418bac8c379e58cb0d6b4a38 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 20 Oct 2023 12:25:10 -0400 Subject: [PATCH] fix include symlink handling for pybind11 libraries --- cmake/xo_cxx.cmake | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/cmake/xo_cxx.cmake b/cmake/xo_cxx.cmake index 6932c3e8..eb9fad7f 100644 --- a/cmake/xo_cxx.cmake +++ b/cmake/xo_cxx.cmake @@ -305,6 +305,8 @@ endmacro() # use this for a subdir that builds a library # and supports find_package() # +# note: used deliberately in xo_pybind11_library() below +# macro(xo_install_library2 target) install( TARGETS ${target} @@ -347,6 +349,18 @@ macro(xo_install_library4 target projectTargets) #xo_install_include_tree() -- use xo_install_include_tree3() separately endmacro() +macro(xo_install_library4_noincludes target projectTargets) + install( + TARGETS ${target} + EXPORT ${projectTargets} + LIBRARY DESTINATION lib COMPONENT Runtime + ARCHIVE DESTINATION lib COMPONENT Development + RUNTIME DESTINATION bin COMPONENT Runtime + PUBLIC_HEADER DESTINATION include COMPONENT Development + BUNDLE DESTINATION bin COMPONENT Runtime + ) +endmacro() + macro(xo_install_library5 target nxo_target projectTargets) install( TARGETS ${target} @@ -524,9 +538,9 @@ macro(xo_pybind11_library target projectTargets source_files) if(XO_SYMLINK_INSTALL) xo_install_make_symlink( - ${PROJECT_BINARY_DIR}/include/xo/${target} - ${CMAKE_INSTALL_PREFIX}/include/xo/${target} - ${target}.hpp) + ${PROJECT_BINARY_DIR}/include/xo + ${CMAKE_INSTALL_PREFIX}/include/xo + ${target}) else() install( FILES ${PROJECT_BINARY_DIR}/include/xo/${target}/${target}.hpp @@ -561,7 +575,9 @@ macro(xo_pybind11_library target projectTargets source_files) xo_pybind11_link_flags() xo_include_options2(${target}) - xo_install_library4(${target} ${projectTargets}) + # don't want to symlink include tree, because lives in build dir. + # see install for generated .hpp above + xo_install_library4_noincludes(${target} ${projectTargets}) endmacro() # ----------------------------------------------------------------