[CMake] Is there a way to obtain the current compiler standard flag?

Chris Green greenc at fnal.gov
Tue May 29 17:37:45 EDT 2018


Hi,

We have to use a utility (Root's rootcling/genreflex tool) as part of a 
custom command to parse some C++ headers. We are in the process of 
migrating from using raw -std= additions to compilation flags to use of 
CMAKE_CXX_STANDARD and friends. We need to pass the correct compiler 
flag to the invocation of rootcling in order to ensure headers are 
parsed correctly based on the CXX_STANDARD and CXX_EXTENSIONS 
properties, but we don't appear to be able to discover what it is. We 
could generate it from scratch like we did before, but it seems like it 
would be preferable to be able to pass it to the command as already 
calculated by CMake, perhaps via a generator expression.

Is there some way to do this already that I missed, or would this be an 
enhancement?

Thanks,

Chris.



More information about the CMake mailing list