Hello, I have a long compilation command like this:
nim c -r -o=../build -d:myUglyVariable:"myUglyValue" main.nim --loglevel=DEBUG
I'd like to move all that in nim.cfg, or at least that ugly variable, so that I type just
nim c -r main.nim
Is that possible? I really lack any docs on nim.cfg file syntax.Yes you can, feel free to check Arraymancer nim.cfg:
https://github.com/mratsim/Arraymancer/blob/master/nim.cfg
@libman: Unfortunately shell scripts would not work on all Windows for example.
@mratsim Cool, thank you very much! Definitely saw that file earlier but VS Code underlines some lines in red so I thought something was wrong... But it works!
# nim.cfg
define:"var=value"
@Libman Sure, but I didn't want to touch shell scripts at all. Not only cause they are ugly but also I think nim itself pushes us towards using nim.cfg for persistent configuration and nimble for package-level tasks. And yes, it's os-independent.
.cfg config helpful when all you need just simply additional options.
Just name the cfg like "yourmodule.nim.cfg" and Nim compiler will only use that option when you try to compile "yourmodule.nim", it won't be used when you compile "anothermodule.nim".