helly25 commented on PR #40763:
URL: https://github.com/apache/arrow/pull/40763#issuecomment-2028836896

   > Your use case is `cmake -DCMAKE_CXX_FLAGS='-D__DATE__=\\"redacted\\"' 
...`, right?
   
   @kou To explain a bit deeper. Both `__DATE__` and `__TIME__` need to be 
actual strings including the `"` (see 
https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html). Now if you 
do not escape the quotes as in `cmake -DCMAKE_CXX_FLAGS='-D__DATE__="redacted"' 
...`, then the result is __DATE__ defined as `redacted` without the quotes 
because the quotes are treated as quotes for the command line/flag parsing. If 
you escape them, then they actually make it to the compiler and are taken as 
part of the define.
   
   Now whether they are quoted or escaped in the header is of little concern 
because they are not used in building any software. They are just a reference 
to check how the software was build.
    
   > I think that you don't need to specify `\`: `cmake 
-DCMAKE_CXX_FLAGS='-D__DATE__="redacted"' ...` Why do you need to escape `"`?
   > 
   > We're using `ESCAPE_QUOTE` to generate `config.h` from `config.h.cmake`. 
It escapes quotes for string literal: 
https://cmake.org/cmake/help/latest/command/configure_file.html I'm worried 
that using both `ESCAPE_QUOTE` and `R"(...)"` escape too much.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to