build: remove StrawberryPerl from ENV{PATH}

On Windows, StrawberryPerl tools and libraries exposed in the PATH
environment variable can pollute and break the build, remove any such
entries for WIN32 as a startup cmake action.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-11-28 10:27:06 -08:00
parent 6d8ca723d0
commit 2a65e92da2
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 21 additions and 0 deletions

View File

@ -33,6 +33,10 @@ endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
if(WIN32)
include(RemoveStrawberryPerlFromPATH)
endif()
if(UPDATE_APPCAST)
include(UpdateAppcast)
endif()

View File

@ -0,0 +1,17 @@
# Remove StrawberryPerl from the PATH environment variable due to various build
# pollution.
unset(new_path)
message("BEFORE: $ENV{PATH}")
foreach(p $ENV{PATH})
if(NOT p MATCHES "(^|\\\\)[Ss]trawberry\\\\([Pp]erl|[Cc])\\\\(.*\\\\)?[Bb]in$")
list(APPEND new_path ${p})
endif()
endforeach(
set(ENV{PATH} "${new_path}")
message("AFTER: $ENV{PATH}")
# vim:sw=4 et sts=4 ts=8: