Fix current working directory for CMake

There is no way around this. The directory where CMake is invoked is
where it writes its build files, so we have to `pushd`. In case anything
fails, we `popd` in a finally block.
This commit is contained in:
Andrew Schwartzmeyer
2016-02-24 11:50:56 -08:00
parent 7047041404
commit 91456111bf
+10 -3
View File
@@ -44,9 +44,16 @@ function Start-PSBuild
$Native = "$PSScriptRoot/src/libpsl-native"
$Lib = "$Native/src/libpsl-native.$Ext"
Write-Host "Building $Lib"
cmake -DCMAKE_BUILD_TYPE=Debug $Native
make -j -C $Native
make -C $Native test
try {
pushd $Native
cmake -DCMAKE_BUILD_TYPE=Debug .
make -j
make test
} finally {
popd
}
if (-Not (Test-Path $Lib)) { throw "Compilation of $Lib failed" }
cp $Lib $Output
}