Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ function(add_paimon_lib LIB_NAME)
# Necessary to make static linking into other shared libraries work properly
set_property(TARGET ${LIB_NAME}_objlib PROPERTY POSITION_INDEPENDENT_CODE 1)
if(ARG_DEPENDENCIES)
# Avoid add_dependencies on non-existent targets (e.g. when building static only).
# In static-only builds, some dependency names are still declared as
# *_shared. Map them to *_static when the shared target is unavailable.
set(_paimon_objlib_deps)
foreach(_paimon_dep IN LISTS ARG_DEPENDENCIES)
if(TARGET ${_paimon_dep})
list(APPEND _paimon_objlib_deps ${_paimon_dep})
set(_paimon_mapped_dep "${_paimon_dep}")
if(NOT TARGET ${_paimon_mapped_dep} AND _paimon_dep MATCHES "_shared$")
string(REGEX REPLACE "_shared$" "_static" _paimon_mapped_dep
"${_paimon_dep}")
endif()
if(TARGET ${_paimon_mapped_dep})
Comment thread
zjw1111 marked this conversation as resolved.
list(APPEND _paimon_objlib_deps ${_paimon_mapped_dep})
endif()
unset(_paimon_mapped_dep)
endforeach()
if(_paimon_objlib_deps)
add_dependencies(${LIB_NAME}_objlib ${_paimon_objlib_deps})
Expand Down
Loading