PengZheng commented on code in PR #608:
URL: https://github.com/apache/celix/pull/608#discussion_r1288312733
##########
cmake/cmake_celix/BundlePackaging.cmake:
##########
@@ -479,59 +478,70 @@ function(celix_bundle_libs)
get_target_property(LIBS ${BUNDLE} "BUNDLE_${TYPE}_LIBS")
get_target_property(DEPS ${BUNDLE} "BUNDLE_DEPEND_TARGETS")
+ get_target_property(LIB_TARGETS ${BUNDLE} "BUNDLE_LIB_TARGETS")
- foreach(LIB IN ITEMS ${ARGN})
+ foreach (LIB IN ITEMS ${ARGN})
string(MAKE_C_IDENTIFIER ${LIB} LIBID)
- if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
- get_filename_component(LIB_NAME ${LIB} NAME)
- set(OUT "${BUNDLE_DIR}/${LIB_NAME}")
- add_custom_command(OUTPUT ${OUT}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB} ${OUT}
- DEPENDS ${LIB}
+ if (IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
+ get_filename_component(LIB_NAME ${LIB} NAME)
+ set(OUT "${BUNDLE_DIR}/${LIB_NAME}")
+ add_custom_command(OUTPUT ${OUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB} ${OUT}
+ DEPENDS ${LIB}
)
if (ADD_TO_MANIFEST)
list(APPEND LIBS ${LIB_NAME})
- endif()
- list(APPEND DEPS ${OUT})
+ endif ()
+ list(APPEND DEPS ${OUT})
elseif (TARGET ${LIB})
get_target_property(TARGET_TYPE ${LIB} TYPE)
#NOTE add_custom_command does not support generator expression in
OUTPUT value (e.g. $<TARGET_FILE:${LIB}>)
#Using a two step approach to be able to use add_custom_command
instead of add_custom_target
set(OUT "${BUNDLE_GEN_DIR}/lib-${LIBID}-copy-timestamp")
if ("${TARGET_TYPE}" STREQUAL "STATIC_LIBRARY")
add_custom_command(OUTPUT ${OUT}
- COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${LIB}>" "${BUNDLE_DIR}/$<TARGET_FILE_NAME:${LIB}>"
- DEPENDS ${LIB}
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${LIB}>" "${BUNDLE_DIR}/$<TARGET_FILE_NAME:${LIB}>"
+ DEPENDS ${LIB}
)
elseif ("${TARGET_TYPE}" STREQUAL "SHARED_LIBRARY")
add_custom_command(OUTPUT ${OUT}
- COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${LIB}>" "${BUNDLE_DIR}/$<TARGET_SONAME_FILE_NAME:${LIB}>"
- DEPENDS ${LIB}
- )
- else()
+ COMMAND ${CMAKE_COMMAND} -E touch ${OUT}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:${LIB}>" "${BUNDLE_DIR}/$<TARGET_SONAME_FILE_NAME:${LIB}>"
+ DEPENDS ${LIB}
+ )
+ get_target_property(IS_IMPORTED ${LIB} IMPORTED)
+ if (NOT IS_IMPORTED)
+ get_target_property(REAL_LIB_TARGET ${LIB} ALIASED_TARGET)
Review Comment:
install does not work for alias.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]