aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_append_to_path.cmake41
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake3
2 files changed, 43 insertions, 1 deletions
diff --git a/scripts/cmake/vcpkg_append_to_path.cmake b/scripts/cmake/vcpkg_append_to_path.cmake
new file mode 100644
index 000000000..6890dfe31
--- /dev/null
+++ b/scripts/cmake/vcpkg_append_to_path.cmake
@@ -0,0 +1,41 @@
+## # 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() \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 6677af00a..f4f149794 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -1,4 +1,5 @@
include(vcpkg_acquire_msys)
+include(vcpkg_append_to_path)
include(vcpkg_check_linkage)
include(vcpkg_download_distfile)
include(vcpkg_extract_source_archive)
@@ -24,4 +25,4 @@ include(vcpkg_copy_tool_dependencies)
include(vcpkg_get_program_files_32_bit)
include(vcpkg_get_program_files_platform_bitness)
include(vcpkg_get_windows_sdk)
-include(vcpkg_replace_string) \ No newline at end of file
+include(vcpkg_replace_string)