[PATCH] Adds a CMake package configuration file for libclang

Brad King brad.king at kitware.com
Thu Mar 7 09:59:47 PST 2013


On 03/07/2013 12:32 PM, Jordan Rose wrote:
> 
> On Mar 7, 2013, at 6:42 , Brad King <brad.king at kitware.com> wrote:
> 
>> One thing the upstream devs should check is whether the version test
>> in libclang-config-version.cmake.in looks correct.  The logic needs to
>> match your interface compatibility and versioning policy.  Currently
>> it says that versions will be forward and backward compatible across
>> all minor versions of the same major version, and that a change in
>> major version breaks compatibility.  This is a reasonable policy, but
>> this code needs to match your actual policy.
> 
> AFAIK libclang is forward-compatible across minor versions, but not
> backwards (i.e. because new features can be introduced with minor versions).

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()

-Brad



More information about the cfe-commits mailing list