-
Notifications
You must be signed in to change notification settings - Fork 211
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
cmake config: Use find_dependency to make linked targets available #1339
Open
autoantwort
wants to merge
1
commit into
AOMediaCodec:main
Choose a base branch
from
autoantwort:fix-dependency-in-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -588,15 +588,15 @@ endif() | |
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) | ||
install( | ||
TARGETS avif | ||
EXPORT ${PROJECT_NAME}-config | ||
EXPORT ${PROJECT_NAME}-targets | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
) | ||
|
||
# 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}) | ||
install(EXPORT ${PROJECT_NAME}-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) | ||
|
||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file( | ||
|
@@ -605,6 +605,29 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) | |
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
) | ||
|
||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake.in "@PACKAGE_INIT@\n") | ||
if(UNIX AND NOT BUILD_SHARED_LIBS) | ||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake.in " | ||
include(CMakeFindDependencyMacro) | ||
set(CMAKE_THREAD_PREFER_PTHREADS ON) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It looks like this flag went away somewhere between 3.2.x and 3.26.x (or it's left out from the documentation) https://cmake.org/cmake/help/v3.2/module/FindThreads.html |
||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_dependency(Threads) | ||
") | ||
endif() | ||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake.in "include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-targets.cmake)") | ||
|
||
# Install CMake configuration export file. | ||
configure_package_config_file( | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO | ||
) | ||
install( | ||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
) | ||
endif() | ||
|
||
# Handle both relative and absolute paths (e.g. NixOS) for a relocatable package | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose in the shared object case, the library's dependency is enough.