How for a binary executable to locate a config file?

When developing the config file is in one path, and after installation the config file is in another path.
It’s a binary who locates the config file, so configure_file will not help.
How to locate the config file in both cases?
Hard coding all the possible locations for the config file into the binary should help,
but that means the path for the config file when developing also should be hard coded, which makes no sense after installation.

It’s not really a CMake question, I guess…
Anyway, I tend to provide a command line option or an environment variable so that one can simply tell the executable where to look for. If nothing is provided, the executable looks in predefined locations (like a path relative to itself, /etc/…, $XDG_CONFIG_HOME…

I think predefined locations are more self-contained, but predefined locations should be different for developing and deploying.

As I said - I just use parameters / environment variables to override. During development one has to constantly fiddle with config files, so it makes sense to have multiple and switch without copying files around.
And ability to override config location in production is also usually a good idea.

In any case this is something YOU decide how to implement in YOUR code. You can have a #define in you code that hardcodes some location when you pass it in your CMake invocation or something like that.

Clear enough

@fenrir Your answers are clear and good enough. Thanks!