-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[vcpkg_setup_pkgconfig_path] Add new functions to set or restore pkgconfig related environment variables #23429
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
38d175b
[vcpkg_configure_meson] Fix append host path
b858854
New functions vcpkg_setup_pkgconfig_path and vcpkg_restore_pkgconfig_…
f37504d
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
fefaa62
Fix bug, add cos
471c441
Apply suggestions
c302ed6
Merge branch 'master' of github.com:microsoft/vcpkg into dev/jack/22812
vicroms 548a445
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
4889eb4
Merge branch 'dev/jack/22812' of https://github.com/JackBoosY/vcpkg i…
47168aa
Apply suggestions
4c52ff5
Apply suggestion
449c934
doc
3ef0734
Update docs/maintainers/vcpkg_setup_pkgconfig_path.cmake.md
JackBoosY f177768
Update scripts/cmake/vcpkg_setup_pkgconfig_path.cmake
JackBoosY fce9c18
Update scripts/cmake/vcpkg_configure_make.cmake
JackBoosY f67ae2f
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
5722870
Merge branch 'dev/jack/22812' of https://github.com/JackBoosY/vcpkg i…
9a7bdb4
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
1fd873e
Apply suggestions
767af25
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
4837448
Apply suggestion
20cd30a
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
94ec276
Apply suggestions
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
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,56 @@ | ||
| #[===[ | ||
| # vcpkg_setup_pkgconfig_path | ||
|
|
||
| Setup the generated pkgconfig file path to PKG_CONFIG_PATH environment variable or restore PKG_CONFIG_PATH environment variable | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```cmake | ||
| vcpkg_setup_pkgconfig_path(BASE_DIRS <"${CURRENT_INSTALLED_DIR}" ...>) | ||
| ``` | ||
| ```cmake | ||
| vcpkg_restore_pkgconfig_path() | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| `vcpkg_setup_pkgconfig_path` prepend the default pkgconfig path passed to it to the PKG_CONFIG_PATH environment variable. | ||
| `vcpkg_restore_pkgconfig_path` should be called after the configure or build procees end. | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
|
|
||
| #]===] | ||
| function(vcpkg_setup_pkgconfig_path) | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
| cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "BASE_DIRS" "") | ||
|
|
||
| if(NOT DEFINED arg_BASE_DIRS OR "${arg_BASE_DIRS}" STREQUAL "") | ||
| message(FATAL_ERROR "BASE_DIR must be passed in") | ||
| endif() | ||
| if(DEFINED arg_UNPARSED_ARGUMENTS) | ||
| message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") | ||
| endif() | ||
|
|
||
| vcpkg_backup_env_variables(VARS PKGCONFIG_PATH PKG_CONFIG PKG_CONFIG_PATH) | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
|
|
||
| vcpkg_find_acquire_program(PKGCONFIG) | ||
| get_filename_component(PKGCONFIG_PATH ${PKGCONFIG} DIRECTORY) | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
| vcpkg_add_to_path("${PKGCONFIG_PATH}") | ||
|
|
||
| if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT PKGCONFIG STREQUAL "--static") | ||
| set(PKGCONFIG "${PKGCONFIG} --static") # Is this still required or was the PR changing the pc files accordingly merged? | ||
| endif() | ||
|
JackBoosY marked this conversation as resolved.
Outdated
|
||
| set(ENV{PKG_CONFIG} "${PKGCONFIG}") # Set via native file? | ||
|
|
||
| foreach(base_dir IN LISTS arg_BASE_DIRS) | ||
| vcpkg_host_path_list(APPEND pkgconfig_share_dirs "${base_dir}/share/pkgconfig/") | ||
| endforeach() | ||
|
|
||
| foreach(base_dir IN LISTS arg_BASE_DIRS) | ||
| vcpkg_host_path_list(APPEND pkgconfig_share_dirs "${base_dir}/lib/pkgconfig/") | ||
| endforeach() | ||
|
|
||
| vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH} ${pkgconfig_installed_dirs} ${pkgconfig_share_dirs}) | ||
| endfunction() | ||
|
|
||
| function(vcpkg_restore_pkgconfig_path) | ||
| cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "") | ||
| if(DEFINED arg_UNPARSED_ARGUMENTS) | ||
| message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") | ||
| endif() | ||
|
|
||
| vcpkg_restore_env_variables(VARS PKGCONFIG_PATH PKG_CONFIG PKG_CONFIG_PATH) | ||
| 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
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.