-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlrun.ps1
37 lines (35 loc) · 1.05 KB
/
lrun.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# run exe file that has already been compiled before
#
function getExePathFromCMakeLists()
{
$content = Get-Content -Path "./CMakeLists.txt"
$lastLine = ""
$contentContainedExeName = ""
foreach($line in $content)
{
if ($line.StartsWith("add_executable"))
{
$index = $line.IndexOf("(")
$contentContainedExeName = $line.Substring($index + 1)
if ([string]::IsNullOrEmpty($contentContainedExeName))
{
$lastLine = $line
continue
}
break
} elseif ($lastLine.StartsWith("add_executable"))
{
$contentContainedExeName = $line
break
}
$lastLine = $line
}
$result = -split $contentContainedExeName
$exePath = "./build/DEBUG/" + $result[0] + ".exe"
return $exePath
}
$exePath = getExePathFromCMakeLists
Write-Host "start running as follows..."
Write-Host "=================================================="
Invoke-Expression $exePath