[cfe-dev] How to dump clang version

Richard Pennington rich at pennware.com
Fri Jul 20 05:45:01 PDT 2012


On Thursday, July 19, 2012 02:15:10 PM Devchandra L Meetei wrote:
> We thought of porting our project to clang, and make it require clang V 3
> and above, as clang 2.9 can not link properly.
> So on detection of lesser version, We would like to print that version is
> not supported.
> 
> so need the version number.
> 

This is the trick I use in my Makefiles. I need to find clang's version to pick 
the directory from which I can take clang's include files.

# Get the clang version.
VERSION := $(shell $(ELLCC)/bin/ecc -v |& grep version |& sed "s/.*version 
\([0-9]*\.[0-9]*\).*/\1/")

I wish there were an easier way.

-Rich



More information about the cfe-dev mailing list