On Mon, Jan 11, 2016 at 16:47:03 -0500, Taylor Braun-Jones wrote:
> I have another INTERFACE property use case that is not whitelisted, but
> should be: VERSION

VERSION is a special property for libraries. Particularly the name for
the file with the actual content of the library (the SOVERSION and name
of the library being symlinks to it):

    https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html

INTERFACE targets have no need for this property.

> Consider library project Foo that uses a header-only project Bar. In
> FooConfig.cmake, it is a important to ensure any projects using Foo also
> use the exact same version of Bar that Foo was originally built with
> (Failure to do so can lead to subtle, hard-to-find bugs like violation of
> the one definition rule). Assuming project Bar creates an imported target
> "Bar" with a VERSION property set like:
> 
>   set_property(TARGET Bar APPEND PROPERTY VERSION 1.2.3)

Also, this property is not a list (probably?), so APPEND isn't really
correct. It indicates that the value here should be (list-)appended to
the existing value.

> Then project Foo should be able to have something like:
> 
> == CMakeLists.txt ==
> ...
> get_property(FOO_BAR_VERSION TARGET BAR PROPERTY VERSION)
> configure_file(FooConfig.cmake.in FooConfig.cmake @ONLY)
> 
> == FooConfig.cmake.in ==
> ...
> find_package(Bar "@FOO_BAR_VERSION@" EXACT REQUIRED)

find_package(Foo) should set a Foo_VERSION variable (if known):

    
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#package-version-file

> But, alas, this is not currently possible. I'm ambivalent about whether
> INTERFACE properties should be whitelisted vs blacklisted vs unrestricted,
> but at least this VERSION property seems valid to allow.

Currently, they are whitelisted, but I think any property not understood
by CMake directly (i.e., user-set properties) would probably be fine.

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to