> Hacking on the compiler to enable this seems extreme to me.

Nah, overall it's the cleanest solution IMHO. Also the compiler PR is pretty 
trivial and self-contained, however it helps simplify the CMake side a great 
deal. CMake is a de facto standard for C/C++ projects so making Nim play nice 
with it just makes Nim more attractive.

> add a config.nims that exports nimCacheDir() & "/" & projectName() & ".json" 
> somewhere cmake can read it

That doesn't work (well) for the reason @RodSteward first pointed out. Every 
time you run `nim c` it'll update the json which triggers full CMake configure.

The key to optimizing this in modern CMake is the 
`set_directory_properties(PROPERTIES CMAKE_CONFIGURE_DEPENDS ${CDEPS})` line. 
CMake sets up the target build system to only call CMake configure if that 
file's timestamp changes.

With this setup running `nim c ... && ninja` now takes me ~2 seconds, whereas 
before it'd take ~20seconds.

Reply via email to