target_compile_definitions with UTF-8 data

I have to set a compiler definition which contains UTF-8 data.


The variable OPTIMAL_REF_DATA_PATH contains UTF-8 data.

But it seems my compiler is getting question marks instead of the international characters I expect.

The generator is Ninja and a quick look in reveals that there are question marks on the command line. This makes me pretty sure that CMake is not writing the Ninja file as UTF-8.

Is it just me? Am I missing something to get this working?

I guess you’re running on Windows. There were some issues in the last 2 years.
Please try again with newest Win10/11, CMake and Ninja version.

I am on Windows 11, ninja 1.11.1 and CMake 3.26.

None of the issues that were referred to correspond to my issue. Mine is about command line arguments to cl.exe that are written in the as “?” instead of UTF-8.

I can reproduce your problem only with Ninja v1.10, but not with v1.11. As issue 21866 explains, UTF-8 was introduced in v1.11

Did you use a new binary dir? If not, probably an old ninja is used. You can check the path to Ninja in the Cachefile.

I am so sorry, I made a mistake in reporting the Ninja version I was using. Indeed, it works with Ninja 1.11. I have Ninja 1.11 in my command line environment, but the CLion IDE I was actually using bundles and uses Ninja 1.10. My issue is with my setup.

Again, I am sorry for the waste of time.