In my code I have
const VERSION {.strdefine.}: string = "unknown"
If I pass -d:VERSION=0.1.0 everything works.
I thought to myself, "I already have the version information in the Nimble file, so why should I repeat it?" and tried the following solution (which turned out not to be one):
before build:
switch("d", "VERSION=" & version)
The task is evaluated:
Attempting to execute hook buildBefore in /home/[…]
But the parameter is not passed to the compiler.
Any ideas on how I can pass the information to the compiler without writing a custom build task?
The problem is solved, but out of curiosity: Does anyone know why my "solution"
before build:
switch("d", "VERSION=" & version)
doesn't work?
I assume a scope issue?