Using info from here: https://nim-lang.org/docs/compilesettings.html
I made this program:
import std/compilesettings
echo querySetting(commandLine)
compiled with "--threads:off" and got this output:
c --colors:on --noNimblePath --threads:off -d:NimblePkgVersion=0.1.0 --hints:off -o:/<path removed>/timmy /<path removed>/timmy.nim
Use the nimscript config: just create a file <name of source file>.nims or config.nims in your project directory and put flags inside:
switch("threads", "off")
switch("mm", "arc")
this also works:
--threads:off
--mm:arc
Nim should pick up all adjacent configs automatically when you compile your program.
Nimscript docs:
Compiler flags only work per project. If you have more than one project in one directory - use name of file as a name of config to set different flags for each of them.
Here first.nim and second.nim - are two separate projects:
first.nim
first.nims # config for `first`
second.nim
second.nims # config for `second`
config.nims # config for both `first` and `second`
If you try to compile second.nim, you should see hints telling you which config files are active:
$ nim c second.nim
Hint: used config file '/.../config.nims' [Conf]
Hint: used config file '/.../second.nims' [Conf]
...
Or, maybe, you're trying to set different compiler flags for two files that will compile to a single executable? As far as I know - it's not possible.
There are also push/pop but almost I sure won't work with those flags
https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas