list available options for --cpu, --os and --cc if the passed option is not found (#11328)

This commit is contained in:
Ico Doornekamp 2019-05-25 20:22:57 +02:00 • committed by Andreas Rumpf
commit 70fb3a93e9
3 changed files with 20 additions and 3 deletions

View file

@ -242,12 +242,20 @@ proc nameToOS*(name: string): TSystemOS =
return i
result = osNone
proc listOSnames*(): seq[string] =
for i in succ(osNone) .. high(TSystemOS):
result.add OS[i].name
proc nameToCPU*(name: string): TSystemCPU =
for i in succ(cpuNone) .. high(TSystemCPU):
if cmpIgnoreStyle(name, CPU[i].name) == 0:
return i
result = cpuNone
proc listCPUnames*(): seq[string] =
for i in succ(cpuNone) .. high(TSystemCPU):
result.add CPU[i].name
proc setTargetFromSystem*(t: var Target) =
t.hostOS = nameToOS(system.hostOS)
t.hostCPU = nameToCPU(system.hostCPU)