From a665cf803f2007c5f21db94839e994a6a42d47df Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sun, 17 Oct 2021 16:25:55 +0900 Subject: [PATCH] Fixed undefined cmake variable at root variable tree. --- tests/IL2C.Core.Test.Fixture/CMakeDriver.cs | 4 ++-- tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs b/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs index c71efdb3..b1faa6dd 100644 --- a/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs +++ b/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs @@ -137,8 +137,8 @@ public static async Task BuildAsync( // Step1: Execute gcc var (gccExitCode, gccLog) = await TestUtilities.ExecuteAsync( - outPath, new[] { binPath }, - Path.Combine(binPath, isWindows ? "gcc.exe" : "gcc"), + outPath, isWindows ? new[] { binPath } : Array.Empty(), + isWindows ? Path.Combine(binPath, "gcc.exe") : "gcc", // NOT windows: uses system default gcc. $"-I{basePath}", incDir, libDir, diff --git a/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs b/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs index 6fc1e1cd..322008dd 100644 --- a/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs +++ b/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs @@ -132,7 +132,7 @@ private static IEnumerable> SplitArguments(string args, Dictionary< } else { - exprs.Add(() => definitions[fxd]()); + exprs.Add(() => definitions.TryGetValue(fxd, out var value) ? value() : string.Empty); } state = 0; index++;