I want to import a config file at compile time, but also need a way to have multiple configurations.

With gcc you could do something like -DIMPORTFROM='"MyConfigFile.txt"'. Is there any equivalent in D?

Hardcoding the config files for different versions and using that is not an option. Requiring a fixed filename and using different paths to configure with -J wouldn't be a good solution for my specific situation either.

So far my best idea was to write the wanted filename to a file and import twice.
enum config = import(import("importFrom.txt"));

That works, but that is additional work for the build script and feels like a hack.

Reply via email to