Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support installing imported targets #167

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

aminya
Copy link
Owner

@aminya aminya commented Oct 18, 2022

Imported targets that include prebuilt libraries cannot be installed using package_project now. This tries to fix the issue

How to test

Try to import an externally built library and re-export it

add_library(built_by_bazel SHARED IMPORTED)
set_property(TARGET built_by_bazel PROPERTY IMPORTED_LOCATION "./bazel-bin/libbuilt_by_bazel.so")
set_target_properties(built_by_bazel PROPERTIES LINKER_LANGUAGE CXX)

target_link_libraries(built_by_bazel INTERFACE project_options project_warnings) # link project_options/warnings

set(INCLUDE_DIR "include") # must be relative paths
target_include_directories(
  built_by_bazel INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${INCLUDE_DIR}>"
                             "$<INSTALL_INTERFACE:./${CMAKE_INSTALL_INCLUDEDIR}>"
)

# Package the project
package_project(
  TARGETS
  built_by_bazel
  PUBLIC_INCLUDES
  ${INCLUDE_DIR}
)

TODO

When the _filtered_list_targets is empty, nothing will be exported, which results in an error. In this case, the imported targets should be exported too.

@aminya aminya added the enhancement New feature or request label Oct 18, 2022
@aminya aminya added this to the v1.0.0 milestone Oct 30, 2022
@aminya aminya added the blocked label May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant