Yes! Sorry again. Thank you for your help. The whole process is like
this:
1. create .dir-locals.el in the top directory with this:
2. visit src/main.C (it can be empty)
3. press F5 (or M-x compile RET)
Actual output
The result is a buffer with the following contents.
-*- mode: compilation; default-directory: "src/" -*-
Compilation started at DATE
printf x$CC
x
Compilation finished at DATE
Expected output
I was expecting
-*- mode: compilation; default-directory: "src/" -*-
Compilation started at DATE
printf x$CC
xmpicc
Compilation finished at DATE
System specifications
- GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of
2017-09-22, modified by Debian
- Linux 4.13.0-32-generic #35-Ubuntu (it's not like Ubuntu is my cup of
tea, but it was the best compromise at the time)