Do not let add_compile_definitions to change my define

In MSYS2 on windows10, I want to add the following define to the ArmCC compiler via add_compile_definitions

-D__TIME__="“NO_TIME”"

But no matter how I write,I can not get the what I wanted.
How can I get this define?

This might be a built-in define that can’t be changed. That said, your quoting looks weird. How is it specified in the CMakeLists.txt or command line and how does it appear in the compile line (make VERBOSE=1 or ninja -v)?

The command line I wanted is
-D__TIME__="\“NO_TIME\”".

thanks

What are you getting? And how are you trying to specify it in code (either CMake or command line)?

Try this in the CMakeLists.txt:

add_compile_definitions("__TIME__=\"NO_TIME\"")

I got this.

That’s what you want though (based on what you’ve said), so that looks good to me. If the compiler is not passing it through to your code, that’s beyond CMake’s abilities.