[cmake-developers] CMake 2.8.12 transitive link regression?
Clinton Stimpson
clinton at elemtech.com
Mon Nov 4 11:16:11 EST 2013
On Monday, November 04, 2013 10:40:15 AM Brad King wrote:
> On 11/04/2013 10:31 AM, Clinton Stimpson wrote:
> > But I see 2 others new problems.
>
> Those are features and they work together as intended.
>
> > 1)
> > cmake_minimum_required(VERSION 2.8)
> > add_library(foo SHARED foo.cpp)
> > add_library(bar SHARED bar.cpp)
> > target_link_libraries(bar foo)
> > set_target_properties(bar PROPERTIES LINK_INTERFACE_LIBRARIES "")
> > add_executable(exe exe.cpp)
> > target_link_libraries(exe bar)
> >
> > With 2.8.12.1, I now get a new warning that I did not get with 2.8.12.
> > I'm
> > not sure why I'm getting that warning because the linking of exe looks
> > correct.
> >
> > CMake Warning (dev) in CMakeLists.txt:
> > Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
> > interface. Run "cmake --help-policy CMP0022" for policy details. Use
> > the
> > cmake_policy command to set the policy and suppress this warning.
> >
> > Target "bar" has an INTERFACE_LINK_LIBRARIES property which differs from
> > its LINK_INTERFACE_LIBRARIES properties.
> >
> > INTERFACE_LINK_LIBRARIES:
> > foo
> >
> > LINK_INTERFACE_LIBRARIES:
> This is a correct warning according to the definition of CMP0022.
> The bug you reported in 2.8.12.0 also caused it to not warn here.
> Prior to my fix CMake did not track the new INTERFACE_LINK_LIBRARIES
> value correctly for the plain tll signature so it didn't realize
> that things would change and therefore did not warn.
>
> > 2)
> > cmake_minimum_required(VERSION 2.8.12)
> > add_library(foo SHARED foo.cpp)
> > add_library(bar SHARED bar.cpp)
> > target_link_libraries(bar foo)
> > set_target_properties(bar PROPERTIES LINK_INTERFACE_LIBRARIES "")
> > add_executable(exe exe.cpp)
> > target_link_libraries(exe bar)
> >
> > I get no warning or error, but my LINK_INTERFACE_LIBRARIES property was
> > not
> > respected and it linked both foo and bar into exe. This appears to be a
> > regression from 2.8.12 to 2.8.12.1.
>
> This is also correct behavior. The NEW behavior of CMP0022
> is to ignore LINK_INTERFACE_LIBRARIES and use the new
> INTERFACE_LINK_LIBRARIES which is now populated by the tll call.
>
> The warning you get when the policy is not set is telling
> you exactly what will change when the policy is set to NEW.
> Therefore it gives you a chance to fix your code before setting
> the policy (by bumping the min req version or explicitly).
>
> This is exactly how policies are intended to work. It was
> very unfortunate that 2.8.12.0 was released without giving
> projects any release candidates with a correct CMP0022 impl.
Ok. Yes, that threw me off when the cmp0022 behavior wasn't correct in
2.8.12.0. And I agree that it is fixed in 2.8.12.1.
Thanks,
Clint
More information about the cmake-developers
mailing list