[CMake] cmake policy CMP0022 error

Clinton Stimpson clinton at elemtech.com
Fri Oct 25 10:52:29 EDT 2013


On Friday, October 25, 2013 08:40:41 AM Stephen Kelly wrote:
> Clinton Stimpson wrote:
> > I have a target where I do this:
> > SET_TARGET_PROPERTIES(mytarget PROPERTIES LINK_INTERFACE_LIBRARIES "")
> > to hide 3rd party libraries from the link interface.
> > 
> > When I do
> > if(APPLE)
> > 
> >   CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
> > 
> > endif()
> > I get an error at generate time.
> > 
> > This is different than my previous experiences with cmake policies.  Based
> > on past experiences, I expected to see a warning if I had
> > CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
> > but used CMake 2.8.12 which introduced CMP0022.
> 
> You might have wrong understanding of policies.
> 
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6d50d0197a5
> 
> Your use of cmake_minimum_required(VERSION 2.8.12) requests the non-backward
> compatible behavior.

Yeah, I knew that.

I'm trying to point out that I did not get a warning when I was using
cmake_minimum_required(VERSION 2.8)
set_target_properties(mytarget PROPERTIES LINK_INTERFACE_LIBRARIES "")
with 
CMake 2.8.12.

That looks like a bug.

> 
> > But in this case, I don't see a warning.
> > The error I get with
> > CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
> > is:
> > 
> > CMake Error in .../CMakeLists.txt:
> >   Target "mytarget" has policy CMP0022 enabled, but also has old-style
> >   LINK_INTERFACE_LIBRARIES properties populated, but it was exported
> >   without the EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style
> >   properties
> > 
> > When I read the output from cmake --help-policy CMP0022, its not clear to
> > me why I'm getting the error.
> 
> 2.8.12 introduced a INTERFACE_LINK_LIBRARIES property, which should be used
> instead of LINK_INTERFACE_LIBRARIES. The policy makes the
> INTERFACE_LINK_LIBRARIES property ignored until it is set to NEW.
> 

Oh! I somehow missed that the name was changed.
INTERFACE_LINK_LIBRARIES -> LINK_INTERFACE_LIBRARIES.
I re-read the docs and now I'm wondering how I missed that, duh.

Thanks,
Clint



More information about the CMake mailing list