@@ -25,6 +25,27 @@ function Invoke-BuildCommand($command, $directory = '.')
25
25
Pop-Location
26
26
}
27
27
28
+ function Remove-PathFolder ($folder )
29
+ {
30
+ [string []]$pathFolders = $env: Path -split " ;"
31
+ for ([int ]$i = 0 ; $i -lt $pathFolders.Count ; $i ++ )
32
+ {
33
+ if ([string ]::Compare($pathFolders [$i ], $folder , $true ) -eq 0 )
34
+ {
35
+ Write-Host " Removing $folder from the PATH"
36
+ $pathFolders.RemoveAt ($i )
37
+ $i --
38
+ }
39
+ }
40
+
41
+ $env: Path = $pathFolders -join " ;"
42
+ }
43
+
44
+ function Add-PathFolder ($folder )
45
+ {
46
+ $env: Path = " $folder ;$env: Path "
47
+ }
48
+
28
49
# The project files that will get built
29
50
$VS2008ProjectFiles = @ ( ' CppUTest.vcproj' , ' tests\AllTests.vcproj' )
30
51
$VS2010ProjectFiles = @ ( ' CppUTest.vcxproj' , ' tests\AllTests.vcxproj' )
@@ -61,7 +82,18 @@ if ($env:PlatformToolset -eq 'v100')
61
82
62
83
if ($env: PlatformToolset -eq ' MinGW' )
63
84
{
64
- $env: Path = " C:\Program Files (x86)\CMake 2.8\bin;C:\MinGW\bin;$env: Path "
85
+ Write-Host " Initial Path: $env: Path "
86
+
87
+ # Need to do some path cleanup first
88
+ Remove-PathFolder " C:\Program Files\Git\bin"
89
+ Remove-PathFolder " C:\Program Files (x86)\Git\bin"
90
+
91
+ # Add cmake and mingw to the path
92
+ Add-PathFolder " C:\Program Files (x86)\CMake 2.8\bin"
93
+ Add-PathFolder " C:\MinGW\bin"
94
+
95
+ Write-Host " Building with Path: $env: Path "
96
+
65
97
Invoke-BuildCommand " cmake -G 'MSYS Makefiles' .." ' cpputest_build'
66
98
Invoke-BuildCommand " mingw32-make all" ' cpputest_build'
67
99
}
0 commit comments