-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from ament/pkg_config_path
add PKG_CONFIG_PATH hook templates
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
ament_package/template/environment_hook/pkg_config_path.bat
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
:: copied from ament_package/template/environment_hook/pkg_config_path.bat | ||
@echo off | ||
|
||
call:ament_prepend_unique_value PKG_CONFIG_PATH "%AMENT_CURRENT_PREFIX%\lib\pkgconfig" | ||
|
||
goto:eof | ||
|
||
|
||
:: Prepend non-duplicate values to environment variables | ||
:: using semicolons as separators and avoiding trailing separators. | ||
:: first argument: the name of the result variable | ||
:: second argument: the value | ||
:ament_prepend_unique_value | ||
setlocal enabledelayedexpansion | ||
:: arguments | ||
set "listname=%~1" | ||
set "value=%~2" | ||
:: skip if path doesn't exist | ||
if NOT EXIST "%value%" ( | ||
goto:eof | ||
) | ||
:: expand the list variable | ||
set "list=!%listname%!" | ||
:: check if the list contains the value | ||
set "is_duplicate=" | ||
if "%list%" NEQ "" ( | ||
for %%v in ("%list:;=";"%") do ( | ||
if "%%~v" == "%value%" set "is_duplicate=1" | ||
) | ||
) | ||
:: if it is not a duplicate prepend it | ||
if "%is_duplicate%" == "" ( | ||
:: if not empty, prepend a semi-colon | ||
if "!list!" NEQ "" set "list=;!list!" | ||
:: prepend the value | ||
set "list=%value%!list!" | ||
) | ||
endlocal & ( | ||
:: set result variable in parent scope | ||
set "%~1=%list%" | ||
) | ||
goto:eof |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# copied from ament_package/template/environment_hook/pkg_config_path.sh | ||
|
||
ament_prepend_unique_value PKG_CONFIG_PATH "$AMENT_CURRENT_PREFIX/lib/pkgconfig" |