[PATCH] Adds a CMake package configuration file for libclang
Brad King
brad.king at kitware.com
Thu Mar 7 11:17:49 PST 2013
On 03/07/2013 02:07 PM, Argyrios Kyrtzidis wrote:
> On Mar 7, 2013, at 9:59 AM, Brad King <brad.king at kitware.com <mailto:brad.king at kitware.com>> wrote:
>> On 03/07/2013 12:32 PM, Jordan Rose wrote:
>>> AFAIK libclang is forward-compatible across minor versions, but not
>>> backwards (i.e. because new features can be introduced with minor versions).
>
> That is correct.
>
>> In that case the logic in the package version file needs to be
>> something like:
>>
>> set(PACKAGE_VERSION @LIBCLANG_LIBRARY_VERSION@)
>> if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @CLANG_VERSION_MAJOR@ AND
>> NOT "${PACKAGE_FIND_VERSION_MINOR}" GREATER @CLANG_VERSION_MINOR@)
>> set(PACKAGE_VERSION_COMPATIBLE 1)
>> if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @CLANG_VERSION_MINOR@)
>> set(PACKAGE_VERSION_EXACT 1) # TODO: check patch level too?
>> endif()
>> endif()
>
> The versions for the libclang API are
>
> CINDEX_VERSION_MAJOR
> CINDEX_VERSION_MINOR
>
> in $clang_source/include/clang-c/Index.h
Great. Damien, please fold this into your next patch revision.
You can use file(STRINGS) to parse the values out of the header.
Thanks,
-Brad
More information about the cfe-commits
mailing list