Repository navigation
cmake FEATURE LibYANG CMake config package #2651
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
Draft
Roytak
wants to merge
10
commits into
devel
Choose a base branch
from
cmake-config
base: devel
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.
+180
−172
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
725b04c
pkg-config BUGFIX private deps in Libs.private
Roytak 546a973
distro REFACTOR remove package tests
Roytak 545d6c1
cmake UPDATE require CMake 3.12
Roytak c08a5b9
cmake REFACTOR keyword link signature of yang
Roytak ec7c12f
cmake UPDATE refresh public header copies
Roytak f46f2e1
cmake BUGFIX do not install internal lcbor.h
Roytak b40f799
cmake FEATURE LibYANG config package
Roytak 047dff0
cmake UPDATE remove FindLibYANG.cmake
Roytak 04eb038
distro UPDATE package the LibYANG CMake package
Roytak de59b7a
actions UPDATE build own sources
Roytak 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 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Generate the CMake config package of a library for the build tree and the installation | ||
| # | ||
| # gen_config_package(LIB_NAME LIB_SOVERSION_FULL [EXPORTS <export-set>...] [PATH_VARS <var>...]) | ||
| # LIB_NAME package name, the template is <LIB_NAME>Config.cmake.in in the source root | ||
| # LIB_SOVERSION_FULL package version, the full SO version of the library | ||
| # EXPORTS optional, export sets installed besides <LIB_NAME>Targets | ||
| # PATH_VARS optional, template variables with installed paths, <var>_BUILD holds the build tree path | ||
| # | ||
| # The template reads its other variables from the scope of the caller. | ||
| include(CMakePackageConfigHelpers) | ||
|
|
||
| function(gen_config_package LIB_NAME LIB_SOVERSION_FULL) | ||
| # the optional arguments into LIB_EXPORTS and LIB_PATH_VARS | ||
| cmake_parse_arguments(PARSE_ARGV 2 LIB "" "" "EXPORTS;PATH_VARS") | ||
| set(LIB_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${LIB_NAME}) | ||
| set(LIB_TEMPLATE ${PROJECT_SOURCE_DIR}/${LIB_NAME}Config.cmake.in) | ||
|
|
||
| # create the version file | ||
| write_basic_package_version_file(${PROJECT_BINARY_DIR}/${LIB_NAME}ConfigVersion.cmake | ||
| VERSION ${LIB_SOVERSION_FULL} COMPATIBILITY SameMajorVersion) | ||
| install(FILES ${PROJECT_BINARY_DIR}/${LIB_NAME}ConfigVersion.cmake DESTINATION ${LIB_CONFIG_DIR}) | ||
|
|
||
| # the targets file of each export set, for the build tree and the installation | ||
| foreach(LIB_EXPORT IN ITEMS ${LIB_NAME}Targets ${LIB_EXPORTS}) | ||
| export(EXPORT ${LIB_EXPORT} NAMESPACE ${LIB_NAME}:: FILE ${PROJECT_BINARY_DIR}/${LIB_EXPORT}.cmake) | ||
| install(EXPORT ${LIB_EXPORT} NAMESPACE ${LIB_NAME}:: DESTINATION ${LIB_CONFIG_DIR}) | ||
| endforeach() | ||
|
|
||
| # the installed config, generated aside so that it does not replace the build tree one | ||
| configure_package_config_file(${LIB_TEMPLATE} ${PROJECT_BINARY_DIR}/CMakeFiles/${LIB_NAME}Config.cmake | ||
| INSTALL_DESTINATION ${LIB_CONFIG_DIR} PATH_VARS ${LIB_PATH_VARS}) | ||
| install(FILES ${PROJECT_BINARY_DIR}/CMakeFiles/${LIB_NAME}Config.cmake DESTINATION ${LIB_CONFIG_DIR}) | ||
|
|
||
| # each path variable set to its <var>_BUILD value | ||
| foreach(LIB_VAR IN LISTS LIB_PATH_VARS) | ||
| set(${LIB_VAR} ${${LIB_VAR}_BUILD}) | ||
| endforeach() | ||
|
|
||
| # the build tree config, the build directory is both its location and its prefix | ||
| configure_package_config_file(${LIB_TEMPLATE} ${PROJECT_BINARY_DIR}/${LIB_NAME}Config.cmake | ||
| INSTALL_DESTINATION ${PROJECT_BINARY_DIR} INSTALL_PREFIX ${PROJECT_BINARY_DIR} PATH_VARS ${LIB_PATH_VARS}) | ||
| endfunction() |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.