From 91456111bfa377ced872084b457ac264edcde74e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 24 Feb 2016 11:50:56 -0800 Subject: [PATCH] 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. --- PowerShellGitHubDev.psm1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 196a468f5b..33b6a6540b 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -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 }