vcpkg/scripts/cmake/vcpkg_add_to_path.cmake
Roger Leigh 6d5eba6a6d xalan-c: Install headers correctly (#4565)
* Add SKIP_CLEAN option to vcpkg_install_msbuild

Also add vcpkg_clean_msbuild function to factor out clean
logic and allow re-use in portfiles.

* xalan-c: Correct header globbing

* vcpkg_install_msbuild: SKIP_CLEAN documentation correction

* [xalan-c] Add explicit check for localmsgindex header.
[docs] Regenerate
2018-10-25 12:34:45 -07:00

41 lines
1.1 KiB
CMake

## # vcpkg_add_to_path
##
## Add a directory to the PATH environment variable
##
## ## Usage
## ```cmake
## vcpkg_add_to_path([PREPEND] <${PYTHON3_DIR}>)
## ```
##
## ## Parameters
## ### <positional>
## The directory to add
##
## ### PREPEND
## Prepends the directory.
##
## The default is to append.
function(vcpkg_add_to_path)
if(NOT "${ARGC}" STREQUAL "1" AND NOT "${ARGC}" STREQUAL "2")
message(FATAL_ERROR "vcpkg_add_to_path() only accepts 1 or 2 arguments.")
endif()
if("${ARGV0}" STREQUAL "PREPEND")
if(NOT "${ARGC}" STREQUAL "2")
message(FATAL_ERROR "Expected second argument.")
endif()
if(CMAKE_HOST_WIN32)
set(ENV{PATH} "${ARGV1};$ENV{PATH}")
else()
set(ENV{PATH} "${ARGV1}:$ENV{PATH}")
endif()
else()
if(NOT "${ARGC}" STREQUAL "1")
message(FATAL_ERROR "Unexpected second argument: ${ARGV1}")
endif()
if(CMAKE_HOST_WIN32)
set(ENV{PATH} "$ENV{PATH};${ARGV0}")
else()
set(ENV{PATH} "$ENV{PATH}:${ARGV0}")
endif()
endif()
endfunction()