]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/tools/vcpkg/scripts/cmake/vcpkg_add_to_path.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / tools / vcpkg / scripts / cmake / vcpkg_add_to_path.cmake
1 #[===[
2 # vcpkg_add_to_path
3
4 Add a directory or directories to the PATH environment variable
5
6 ```cmake
7 vcpkg_add_to_path([PREPEND] [<path>...])
8 ```
9
10 `vcpkg_add_to_path` adds all of the paths passed to it to the PATH environment variable.
11 If PREPEND is passed, then those paths are prepended to the PATH environment variable,
12 so that they are searched first; otherwise, those paths are appended, so they are
13 searched after the paths which are already in the environment variable.
14
15 The paths are added in the order received, so that the first path is always searched
16 before a later path.
17
18 If no paths are passed, then nothing will be done.
19
20 ## Examples:
21 * [curl](https://github.com/Microsoft/vcpkg/blob/master/ports/curl/portfile.cmake#L75)
22 * [folly](https://github.com/Microsoft/vcpkg/blob/master/ports/folly/portfile.cmake#L15)
23 * [z3](https://github.com/Microsoft/vcpkg/blob/master/ports/z3/portfile.cmake#L13)
24 #]===]
25 function(vcpkg_add_to_path)
26 cmake_parse_arguments(PARSE_ARGV 0 "arg" "PREPEND" "" "")
27 if(NOT DEFINED arg_UNPARSED_ARGUMENTS)
28 return()
29 endif()
30
31 list(JOIN arg_UNPARSED_ARGUMENTS "${VCPKG_HOST_PATH_SEPARATOR}" add_to_path)
32 if(arg_PREPEND)
33 set(ENV{PATH} "${add_to_path}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PATH}")
34 else()
35 set(ENV{PATH} "$ENV{PATH}${VCPKG_HOST_PATH_SEPARATOR}${add_to_path}")
36 endif()
37 endfunction()