I often use a makefile rule to generate "foo.exe" for each "foo.nim" %.exe: %.nim nim c -o:$@ $< Run
To me the real problem is that "nim c" alters source directories by default. As a general rule, it's helpful if a build system builds into the current-working-directory, so you can simply delete the entire directory later. mkdir build cd build nim c -r ../test/foo.nim Run Maybe it doesn't work that way because it would require unique names? Not sure. As mentioned here, `nim r foo.nim` uses the cache-dir and avoids recompilation on subsequent calls, which helps. But I sometimes have to define new cache-directories. I work in an enterprise environment, not on my own private laptop, so a shared cache-directory is problematic. That's not a complaint; just something to beware.