Skip to content
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
b499ded
vcpkg-make initial idea
Neumann-A Aug 15, 2023
62eb284
don't run ci
Neumann-A Aug 15, 2023
fffa564
Make vcpkg portfile execution debugable
Neumann-A Aug 16, 2023
2e1d32a
WIP
Neumann-A Aug 17, 2023
36ce65c
more WIP
Neumann-A Aug 17, 2023
23d3308
install wrappers
Neumann-A Aug 18, 2023
92457bf
keep the configure_make somewhere for reference
Neumann-A Aug 18, 2023
ab57ae7
add function to warn about spaces
Neumann-A Aug 18, 2023
7918e80
strip whitespaces
Neumann-A Aug 18, 2023
d3b8148
WIP
Neumann-A Aug 18, 2023
1f56817
determine configure triplet
Neumann-A Aug 18, 2023
3ee0aa0
wip
Neumann-A Aug 18, 2023
799b4c8
WIP
Neumann-A Aug 18, 2023
eaf0b67
WIP . move more stuff over.
Neumann-A Aug 23, 2023
c0dc7d7
WIP: create vcpkg_make_install
Neumann-A Aug 25, 2023
c5381ab
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Aug 25, 2023
3933374
WIP code tuning
Neumann-A Aug 25, 2023
3952202
rename function to z_vcpkg_make_get_configure_triplets
Neumann-A Aug 25, 2023
407d3f8
Merge branch 'vcpkg-make' of https://github.com/Neumann-A/vcpkg into …
Neumann-A Aug 25, 2023
0b0df8d
add configure cache
Neumann-A Aug 27, 2023
facb152
More wip
Neumann-A Aug 28, 2023
55ab880
fix includes
Neumann-A Aug 28, 2023
fb6f0b0
fix automatic file include
Neumann-A Aug 28, 2023
1bf57d6
make gmp use the new stuff
Neumann-A Aug 28, 2023
a3621d3
fix stuff to configure (build flags are missing somehow)
Neumann-A Aug 28, 2023
02dab22
more fixes
Neumann-A Aug 28, 2023
f9fc193
cleanup message
Neumann-A Aug 28, 2023
06dd260
remove "
Neumann-A Aug 28, 2023
051adc4
adjust tasks to test gmp
Neumann-A Aug 28, 2023
5a181bf
move logfile analysis
Neumann-A Aug 28, 2023
a341a3d
minor fixes
Neumann-A Aug 28, 2023
98f78da
revert pipeline
Neumann-A Aug 28, 2023
ce6f56f
backup path
Neumann-A Aug 29, 2023
6434434
rename files
Neumann-A Aug 31, 2023
c7f2cc1
create vcpkg-scripts and move stuff around
Neumann-A Aug 31, 2023
1430692
move more stuff
Neumann-A Aug 31, 2023
db55c39
more z_ prefixes
Neumann-A Aug 31, 2023
1925080
fix include naming
Neumann-A Aug 31, 2023
5092636
fix linux
Neumann-A Sep 1, 2023
b3038de
fix linux ?
Neumann-A Sep 1, 2023
3daa802
use umask
Neumann-A Sep 1, 2023
8e12b77
lists everywhere
Neumann-A Sep 1, 2023
d896766
play with configure_env
Neumann-A Sep 1, 2023
569bbf0
get logs
Neumann-A Sep 6, 2023
e91d8cd
retry
Neumann-A Sep 7, 2023
85307d2
print message
Neumann-A Sep 7, 2023
af115c9
move stuff to the correct location
Neumann-A Sep 7, 2023
1c82d5a
more changes
Neumann-A Sep 8, 2023
636bf54
next try to figure out where abiflags get ignored
Neumann-A Sep 12, 2023
f17b7a0
more debugging
Neumann-A Sep 12, 2023
75f71e5
was this the issue?
Neumann-A Sep 12, 2023
9a22df8
remove env settinng
Neumann-A Sep 12, 2023
aac6d97
use correct config var
Neumann-A Sep 13, 2023
ab1dfff
cleanup
Neumann-A Sep 13, 2023
9039911
revert zlib
Neumann-A Sep 13, 2023
4737d7f
revert pipeline
Neumann-A Sep 13, 2023
cc46900
dont error gmp
Neumann-A Sep 13, 2023
43f84ae
guard extra opts correctly
Neumann-A Sep 14, 2023
14d1540
fix bugs
Neumann-A Sep 15, 2023
5dbcba9
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Sep 22, 2023
4a6c3ae
remove vcpkg-make-test to make the PR look green
Neumann-A Sep 22, 2023
eccecb3
use --x-cmake(-port)?-debug
Neumann-A Sep 22, 2023
636ee01
Merge branch 'vcpkg-make' of https://github.com/Neumann-A/vcpkg into …
Neumann-A Sep 22, 2023
30037a3
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Sep 24, 2023
68e8a17
format manifest
Neumann-A Sep 24, 2023
0262490
v db
Neumann-A Sep 24, 2023
132a1fd
Merge branch 'microsoft:master' into vcpkg-make
Neumann-A Sep 26, 2023
be02f37
Merge branch 'master' into vcpkg-make
Neumann-A Oct 5, 2023
3d05e58
Apply suggestions from code review
Neumann-A Oct 5, 2023
ea23f7a
move general stuff to vcpkg-scripts
Neumann-A Oct 5, 2023
a2384ee
v db
Neumann-A Oct 5, 2023
594951e
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Nov 29, 2023
4ca2935
Apply suggestions from code review
Neumann-A Nov 29, 2023
30d7344
Merge branch 'vcpkg-make' of https://github.com/Neumann-A/vcpkg into …
Neumann-A Nov 29, 2023
d7de9e3
revert user vscode settings
Neumann-A Nov 29, 2023
bc55b5f
add missing transformation for 'current_installed_dir_msys'
Neumann-A Nov 29, 2023
db21699
correctly use VCPKG_CMAKE_CONFIGURE_OPTIONS
Neumann-A Nov 29, 2023
40ca608
switch x264 to vcpkg-make
Neumann-A Nov 29, 2023
77dc21c
Looks like vcpkg-make needs to write response files for MSVC
Neumann-A Nov 29, 2023
931e197
move vcpkg-scripts back into vcpkg-make
Neumann-A Dec 1, 2023
820014b
Fix flags passing
Neumann-A Dec 1, 2023
ee20937
use response file
Neumann-A Dec 1, 2023
2e9ee94
add USE_RESPONSE_FILES
Neumann-A Dec 2, 2023
825d759
switch coin-or-cbc
Neumann-A Dec 2, 2023
411337e
add NASM into PATH for android
Neumann-A Dec 2, 2023
774470b
make env override platform consistent.
Neumann-A Dec 5, 2023
d5c4a4b
bump port version
Neumann-A Dec 6, 2023
285e34a
v db
Neumann-A Dec 6, 2023
ffe8e94
Apply a few suggestions from code review
Neumann-A Jan 13, 2024
bab5cb1
rename missed NO_WRAPPERS
Neumann-A Jan 13, 2024
4d34bee
v db
Neumann-A Jan 15, 2024
5215e66
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Jan 15, 2024
b65888c
v db
Neumann-A Jan 15, 2024
32c3953
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Jan 29, 2024
c859085
v db
Neumann-A Jan 29, 2024
8cecf44
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Feb 4, 2024
ecdd5cb
revert changes to libbson
Neumann-A Feb 4, 2024
00c37b0
remove vcpkg_autotools_configure
Neumann-A Feb 4, 2024
4957b2f
remove libbson v db
Neumann-A Feb 4, 2024
d5e0f13
v db
Neumann-A Feb 4, 2024
853f547
Merge branch 'microsoft:master' into vcpkg-make
Neumann-A Feb 8, 2024
2c0f274
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A Apr 29, 2024
f730e39
remove cacheing
Neumann-A Apr 29, 2024
39d86c1
remove ADD_BIN_TO_PATH
Neumann-A Apr 29, 2024
dfb60ab
remove POST_CONFIGURE_CMAKE_COMMANDS
Neumann-A Apr 29, 2024
cd156fe
remove some comments
Neumann-A Apr 29, 2024
e590d18
v db
Neumann-A Apr 29, 2024
4b53ef9
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A May 1, 2024
e528798
port libidn2 to vcpkg-make
Neumann-A May 1, 2024
7af0699
v db
Neumann-A May 1, 2024
940d428
Merge remote-tracking branch 'upstream/master' into vcpkg-make
Neumann-A May 15, 2024
a94f56b
Remove SHELL as a toplevel option for now
Neumann-A May 15, 2024
0b8b6cc
v db
Neumann-A May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ __pycache__/
# vcpkg - Start
############################################################

.vscode/
#.vscode/
Comment thread
Neumann-A marked this conversation as resolved.
Outdated
*.code-workspace
/buildtrees/
/build*/
Expand Down
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
Comment thread
Neumann-A marked this conversation as resolved.
Outdated
// Verwendet IntelliSense zum Ermitteln möglicher Attribute.
// Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "cmake",
"cmakeDebugType" : "external",
"request": "launch",
"name": "vcpkg-external-debug",
"pipeName": "\\\\.\\pipe\\vcpkg-cmake-debugging"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.generator" : "Ninja"
}
95 changes: 95 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Remove-vcpkg-make-test",
"type": "shell",
"command": "${workspaceFolder}/vcpkg remove vcpkg-make --recurse",
},
{
"label": "Debug CMake configure within vcpkg",
"type": "shell",
"dependsOn" : [
"Remove-vcpkg-make-test"
],
"command": "${workspaceFolder}/vcpkg",
"args" : [
"install",
"vcpkg-make-test",
"--binarysource=clear",
"--x-cmake-args=-DVCPKG_CMAKE_CONFIGURE_OPTIONS=--debugger;--debugger-pipe=\\\\.\\pipe\\vcpkg-cmake-debugging"
],
"isBackground": true,
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "Computing installation plan",
"endsPattern": "Configuring x64-windows-release",
}
}
]
},
{
"label": "Debug portfile execution",
"type": "shell",
"dependsOn" : [
"Remove-vcpkg-make-test"
],
"command": "${workspaceFolder}/vcpkg",
"args" : [
"install",
"vcpkg-make-test",
"--binarysource=clear",
"--x-cmake-args=--debugger",
"--x-cmake-args=--debugger-pipe=\\\\.\\pipe\\vcpkg-cmake-debugging"
],
"isBackground": true,
"group": "none",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "Computing installation plan",
"endsPattern": "Configuring x64-windows-release",
}
}
]
},
{
"type": "cmake",
"label": "CMake: Installieren",
"command": "install",
"problemMatcher": [],
"detail": "CMake-Vorlage Installieren Aufgabe"
},

]
}
1 change: 1 addition & 0 deletions ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ foreach(flag ${VCPKG_LANGUAGES} SHARED_LINKER EXE_LINKER STATIC_LINKER MODULE_LI
endif()
endif()
endif()
string(STRIP "${${flag}_FLAGS}" "${flag}_FLAGS")
escaped(value "${${flag}_FLAGS}")
string(APPEND OUTPUT_STRING "set(VCPKG_COMBINED_${flag}_FLAGS_${VCPKG_CONFIGS} \"${value}\")\n")
endforeach()
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake-get-vars/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vcpkg-cmake-get-vars",
"version-date": "2023-03-02",
"version-date": "2023-08-18",
"documentation": "https://vcpkg.io/en/docs/README.html",
"license": "MIT",
"dependencies": [
Expand Down
4 changes: 4 additions & 0 deletions ports/vcpkg-make-test/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vcpkg_make_configure()
vcpkg_make_install()

# Note to self: Force install local cmake extension with external debugger support via: code --install-extension .\cmake-tools.vsix --force
10 changes: 10 additions & 0 deletions ports/vcpkg-make-test/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "vcpkg-make-test",
"version-date": "2023-05-15",
"documentation": "https://vcpkg.io/en/docs/maintainers/ports/vcpkg-make.html",
"license": "MIT",
"supports": "native",
"dependencies" : [
"vcpkg-make"
]
}
34 changes: 34 additions & 0 deletions ports/vcpkg-make/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
set(VCPKG_POLICY_CMAKE_HELPER_PORT enabled)

vcpkg_download_distfile(
ar_lib_wrapper
URLS https://raw.githubusercontent.com/autotools-mirror/automake/43a53bdf4b76377b5c012b8c8e8f478fb56d1ec0/lib/ar-lib
FILENAME ar-lib
SHA512 6019ffebf4b7b0547aa018c7d19bc915a228825d2acdee953a36919a88c30352e620f61c27a3e6f701af2885c8eb8d4ba3a4a3c2e821c54c03dceeef8eec108f
)
vcpkg_download_distfile(
compile_wrapper
URLS https://raw.githubusercontent.com/autotools-mirror/automake/43a53bdf4b76377b5c012b8c8e8f478fb56d1ec0/lib/compile
FILENAME compile
SHA512 3ef82f486f59be4cae1f1f95a9b70d4404f0333100be84c2e7061bd466201224a2bd1c7d871d97801eb9a441809bb47e7821fca8c85c29cc43ab15e6edda7f8c
)

file(COPY
"${CMAKE_CURRENT_LIST_DIR}/"
DESTINATION
"${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
file(COPY
"${ar_lib_wrapper}"
"${compile_wrapper}"
DESTINATION
"${CURRENT_PACKAGES_DIR}/share/${PORT}/wrappers"
)

file(REMOVE
"${CURRENT_PACKAGES_DIR}/share/${PORT}/portfile.cmake"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg.json"
)

vcpkg_install_copyright(FILE_LIST "${VCPKG_ROOT_DIR}/LICENSE.txt")

194 changes: 194 additions & 0 deletions ports/vcpkg-make/vcpkg-make-common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
include_guard(GLOBAL)

### Mapping variables
macro(z_vcpkg_make_set_common_vars)
set(path_suffix_RELEASE "")
set(path_suffix_DEBUG "/debug")
set(suffix_RELEASE "rel")
set(suffix_DEBUG "dbg")
foreach(config IN ITEMS RELEASE DEBUG)
set("workdir_${config}" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${config}}")
endforeach()
Comment thread
Neumann-A marked this conversation as resolved.
Outdated
endmacro()

####
function(z_vcpkg_make_determine_arch out_var value)
if(${value} MATCHES "(amd|AMD)64")
set(${out_var} x86_64 PARENT_SCOPE)
elseif(${value} MATCHES "(x|X)86")
set(${out_var} i686 PARENT_SCOPE)
elseif(${value} MATCHES "^(ARM|arm)64$")
set(${out_var} aarch64 PARENT_SCOPE)
elseif(${value} MATCHES "^(ARM|arm)$")
set(${out_var} arm PARENT_SCOPE)
elseif(${value} MATCHES "^(x86_64|i686|aarch64|arm)$" OR NOT VCPKG_TARGET_IS_WINDOWS)
# Do nothing an assume valid architectures
set("${out_var}" "${value}" PARENT_SCOPE)
else()
message(FATAL_ERROR "Unsupported architecture '${value}' in '${CMAKE_CURRENT_FUNCTION}'!" )
endif()
endfunction()

function(z_vcpkg_make_determine_host_arch out_var)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(arch $ENV{PROCESSOR_ARCHITEW6432})
elseif(DEFINED ENV{PROCESSOR_ARCHITECTURE})
set(arch $ENV{PROCESSOR_ARCHITECTURE})
else()
set(arch "${VCPKG_DETECTED_CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
z_vcpkg_make_determine_arch("${out_var}" "${arch}")
set("${out_var}" "${${out_var}}" PARENT_SCOPE)
endfunction()

function(z_vcpkg_make_determine_target_arch out_var)
list(LENGTH VCPKG_OSX_ARCHITECTURES osx_archs_num)
if(osx_archs_num GREATER_EQUAL 2 AND VCPKG_TARGET_IS_OSX)
set(${out_var} "universal")
else()
z_vcpkg_make_determine_arch(${out_var} "${VCPKG_TARGET_ARCHITECTURE}")
endif()
set("${out_var}" "${${out_var}}" PARENT_SCOPE)
endfunction()


function(z_vcpkg_make_prepare_compiler_flags)
cmake_parse_arguments(PARSE_ARGV 0 arg
"NO_CPP"
"LIBS_OUT"
"LANGUAGES"
)
if(DEFINED arg_LANGUAGES)
# What a nice trick to get more output from vcpkg_cmake_get_vars if required
# But what will it return for ASM on windows? TODO: Needs actual testing
# list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DVCPKG_LANGUAGES=C\;CXX\;ASM") ASM compiler will point to CL with MSVC
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DVCPKG_LANGUAGES=${arg_LANGUAGES}")
endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")

#TODO: parent scope requiered vars

endfunction()

function(z_vcpkg_make_prepare_environment_common)
endfunction()


### General helper scripts (should maybe be moved to a seperate port)

function(z_vcpkg_convert_to_msys_path outvar invar)
if(CMAKE_HOST_WIN32)
string(REGEX REPLACE "^([a-zA-Z]):/" "/\\1/" current_installed_dir_msys "${invar}")
endif()
set("${outvar}" "${current_installed_dir_msys}" PARENT_SCOPE)
endfunction()
function(z_vcpkg_escape_spaces_in_path outvar invar)
string(REPLACE " " "\\ " current_installed_dir_escaped "${invar}")
set("${outvar}" "${current_installed_dir_escaped}" PARENT_SCOPE)
endfunction()

macro(z_vcpkg_unparsed_args warning_level)
if(DEFINED arg_UNPARSED_ARGUMENTS)
message("${warning_level}" "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()
endmacro()

macro(z_vcpkg_conflicting_args)
set(conflicting_args_set "")
foreach(z_vcpkg_conflicting_args_index RANGE 0 "${ARGC}")
if(${ARGV${z_vcpkg_conflicting_args_index}})
list(APPEND conflicting_args_set "${ARGV${z_vcpkg_conflicting_args_index}}")
endif()
endforeach()
list(LENGTH conflicting_args_set conflicting_args_set_length)
if(conflicting_args_set_length GREATER 1)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed conflicting arguments:'${conflicting_args_set}'. Only one of those arguments can be passed")
endif()
unset(conflicting_args_set_length)
unset(conflicting_args_set)
unset(z_vcpkg_conflicting_args_index)
endmacro()

function(z_vcpkg_set_global_property property value)
if(DEFINED ARGN AND NOT ARGN MATCHES "^APPEND(_STRING)?$")
message(FATAL_ERROR "'${CMAKE_CURRENT_FUNCTION}' called with invalid arguments '${ARGN}'")
endif()
set_property(GLOBAL ${ARGN} PROPERTY "z_vcpkg_global_property_${property}" ${value})
endfunction()

function(z_vcpkg_get_global_property outvar property)
if(DEFINED ARGN AND NOT ARGN STREQUAL "SET")
message(FATAL_ERROR "'${CMAKE_CURRENT_FUNCTION}' called with invalid arguments '${ARGN}'")
endif()
get_property(outprop GLOBAL PROPERTY "z_vcpkg_global_property_${property}" ${ARGN})
set(${outvar} "${outprop}" PARENT_SCOPE)
endfunction()

function(z_vcpkg_warn_path_with_spaces)
vcpkg_list(SET z_vcm_paths_with_spaces)
if(CURRENT_BUILDTREES_DIR MATCHES " ")
vcpkg_list(APPEND z_vcm_paths_with_spaces "${CURRENT_BUILDTREES_DIR}")
endif()
if(CURRENT_PACKAGES_DIR MATCHES " ")
vcpkg_list(APPEND z_vcm_paths_with_spaces "${CURRENT_PACKAGES_DIR}")
endif()
if(CURRENT_INSTALLED_DIR MATCHES " ")
vcpkg_list(APPEND z_vcm_paths_with_spaces "${CURRENT_INSTALLED_DIR}")
endif()
if(z_vcm_paths_with_spaces)
# Don't bother with whitespace. The tools will probably fail and I tried very hard trying to make it work (no success so far)!
vcpkg_list(APPEND z_vcm_paths_with_spaces "Please move the path to one without whitespaces!")
list(JOIN z_vcm_paths_with_spaces "\n " z_vcm_paths_with_spaces)
message(STATUS "Warning: Paths with embedded space may be handled incorrectly by configure:\n ${z_vcm_paths_with_spaces}")
endif()
endfunctioN()

###
function(vcpkg_insert_msys_into_path msys_out)
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"PATH_OUT"
"PACKAGES"
)
vcpkg_acquire_msys(MSYS_ROOT PACKAGES ${arg_ADDITIONAL_PACKAGES})
cmake_path(CONVERT "$ENV{PATH}" TO_CMAKE_PATH_LIST path_list NORMALIZE)
cmake_path(CONVERT "$ENV{SystemRoot}" TO_CMAKE_PATH_LIST system_root NORMALIZE)
cmake_path(CONVERT "$ENV{LOCALAPPDATA}" TO_CMAKE_PATH_LIST local_app_data NORMALIZE)
file(REAL_PATH "${system_root}" system_root)

vcpkg_list(SET find_system_dirs
"${system_root}/system32"
"${system_root}/System32"
"${system_root}/system32/"
"${system_root}/System32/"
"${local_app_data}/Microsoft/WindowsApps"
"${local_app_data}/Microsoft/WindowsApps/"
)

string(TOUPPER "${find_system_dirs}" find_system_dirs_upper)

set(index 0)
set(appending TRUE)
foreach(item IN LISTS path_list)
if(item IN_LIST find_system_dirs OR item IN_LIST find_system_dirs_upper)
set(appending FALSE)
break()
endif()
math(EXPR index "${index} + 1")
endforeach()

if(appending)
message(WARNING "Unable to find system dir in the PATH variable! Appending required msys paths!")
endif()
vcpkg_list(INSERT path_list "${index}" "${MSYS_ROOT}/usr/bin")

cmake_path(CONVERT "${path_list}" TO_NATIVE_PATH_LIST native_path_list)
set(ENV{PATH} "${native_path_list}") # Should this be backed up?

if(DEFINED arg_PATH_OUT)
set("${arg_PATH_OUT}" "${path_list}" PARENT_SCOPE)
endif()

set("${msys_out}" "${MSYS_ROOT}" PARENT_SCOPE)
endfunction()
Loading