summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2019-10-08 07:10:55 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-10-08 08:10:55 +0200
commit0355c64b92ad388c1dade93415630df16256500b (patch)
treea61b3d55e0c86eb5d516d21d6551f81cb2c1d625 /compiler
parent509f53b782273a2ee5e130a7f5e9c57f079cc93e (diff)
downloadNim-0355c64b92ad388c1dade93415630df16256500b.tar.gz
External file compilation improvement (#12380)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/extccomp.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 4c531e894..c06ade3a5 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -662,6 +662,10 @@ proc addExternalFileToCompile*(conf: ConfigRef; c: var Cfile) =
   if optForceFullMake notin conf.globalOptions and fileExists(c.obj) and
       not externalFileChanged(conf, c):
     c.flags.incl CfileFlag.Cached
+  else:
+    # make sure Nim keeps recompiling the external file on reruns
+    # if compilation is not successful  
+    discard tryRemoveFile(c.obj.string)
   conf.toCompile.add(c)
 
 proc addExternalFileToCompile*(conf: ConfigRef; filename: AbsoluteFile) =