Only INSTALL_INTERFACE for static.#2269
Merged
Merged
Conversation
wantehchang
reviewed
Jul 15, 2024
wantehchang
reviewed
Jul 15, 2024
| get_target_property(target_type ${target} TYPE) | ||
| if(target_type STREQUAL "SHARED_LIBRARY" OR NOT BUILD_SHARED_LIBS) | ||
| # The transitive dependency is an export link library if it is a static library in a static build. | ||
| if(NOT BUILD_SHARED_LIBS) |
Member
There was a problem hiding this comment.
I also wanted to note that we can't test this code (lines 172-174) right now, because in a static build, the cmake config files are not installed:
# Enable CMake configs in VCPKG mode
if(BUILD_SHARED_LIBS OR VCPKG_TARGET_TRIPLET)
install(EXPORT ${PROJECT_NAME}-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${PROJECT_NAME}-config-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
endif()
I tried to test this code last week but could not make it work. Another difficulty is that in a static build, the library we install is avif_static, not avif:
if(BUILD_SHARED_LIBS)
set(LIBAVIF_INSTALL_TARGET avif)
else()
set(LIBAVIF_INSTALL_TARGET avif_static)
endif()
where avif_static is the merged archive library:
merge_static_libs(avif_static avif)
I am wondering if avif_static does not inherit the link libraries of avif that we set here.
Contributor
Author
There was a problem hiding this comment.
I am playing with an installed static CI right now to debug this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #2264