Notes |
|
(0034264)
|
Stephen Kelly
|
2013-10-27 06:04
|
|
|
|
(0034281)
|
Clinton Stimpson
|
2013-10-29 08:53
|
|
Maybe that should be the advice. When I run CMake, I get this error:
Target "foo" 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
which tells me the newly expected EXPORT_LINK_INTERFACE_LIBRARIES is not set to help an old property keeps working. So I take that to mean that I now need to set it to fix my problem.
But then I read cmake --help-policy CMP0022, and it appears I get different advice, that is, I should be setting INTERFACE_LINK_LIBRARIES instead.
Perhaps the error message and policy help need improved so they can be reconciled.
Eventually, I think I'll end up using the PUBLIC/PRIVATE keywords in target_link_libraries() (maybe this can be mentioned as an alternative in the policy help).
But for now, I set the policy to old since I want 2.8.12 as a minimum version on Mac OS X only. |
|
|
(0034283)
|
Clinton Stimpson
|
2013-10-29 09:16
|
|
And I would like the warning to say the same thing as the error. And both of those consistent with the policy help. |
|
|
(0034285)
|
Stephen Kelly
|
2013-10-29 11:54
|
|
> But then I read cmake --help-policy CMP0022, and it appears I get different
> advice, that is, I should be setting INTERFACE_LINK_LIBRARIES instead.
It also says this:
> A new option to the install(EXPORT) and export commands
> allows export of the old-style properties for compatibility with
> downstream users of CMake versions older than 2.8.12.
which is a reference to EXPORT_LINK_INTERFACE_LIBRARIES, though it is not mentioned by name. Is that what is not clear?
Usually with policies, we're pointing out code that is buggy even if the user is using an older cmake version. We can advise them to change the code. In this case, we can't advise them to use INTERFACE_LINK_LIBRARIES or EXPORT_LINK_INTERFACE_LIBRARIES in a warning if they don't have 2.8.12 as their minimum requirement (In which case an error is reported already).
Brad, any input on this? |
|
|
(0034286)
|
Clinton Stimpson
|
2013-10-29 12:05
|
|
Other cases may be buggy, but I don't consider my code buggy.
Wasn't it recommended in older versions of CMake to use LINK_INTERFACE_LIBRARIES to control the public dependencies? I think it used to be the only way to control it.
But now that is old. The confusion is that it wasn't clear to me what the problem actually was and why, and there was no clear path forward. The error says one thing, the policy help says another. That is why I'm dealing with it later and setting it to old for now. |
|
|
(0034287)
|
Stephen Kelly
|
2013-10-29 13:09
|
|
Ok.
To be clear. I never said your code was buggy. I said the opposite, which is what makes this case difficult. |
|
|
(0034288)
|
Clinton Stimpson
|
2013-10-29 14:58
|
|
Here's another related one where minimum version is 2.8 and new syntax is used:
cmake_minimum_required(VERSION 2.8)
add_library(foo SHARED foo.cpp)
add_library(foo2 SHARED foo2.cpp)
target_link_libraries(foo2 foo)
set_target_properties(foo2 PROPERTIES INTERFACE_LINK_LIBRARIES "")
add_executable(app app.cpp)
target_link_libraries(app foo2)
It gives the warning:
Target "foo2" has a INTERFACE_LINK_LIBRARIES property which differs from
its LINK_INTERFACE_LIBRARIES properties.
INTERFACE_LINK_LIBRARIES:
LINK_INTERFACE_LIBRARIES:
(empty)
That doesn't make sense because I never set the LINK_INTERFACE_LIBRARIES property. |
|
|
(0034290)
|
Stephen Kelly
|
2013-10-29 17:02
|
|
As I wrote in the comment above:
> In this case, we can't advise them to use INTERFACE_LINK_LIBRARIES
The LINK_INTERFACE_LIBRARIES property is populated because you don't set CMP0022 to NEW. |
|
|
(0034292)
|
Brad King
|
2013-10-30 09:34
|
|
In the original example in the description I see no reason that it should warn. The code works as it always did and the exported results are the same with 2.8.11 or 2.8.12, no?
A policy warning is for when the newer CMake wants to do something different than the older CMake with the same code but can't because the project has no code that tells CMake it is aware of the newer preference (e.g. policy setting). Once a project has been modified with cmake_minimum_required at least the newer CMake then we know the project is aware of the new preferred behavior.
By upping the min req version to 2.8.12 you are telling CMake you are okay with preferred behavior as of that level. In this case that is an error message. As the developer bumping the min req version it is up to you to make it work. |
|
|
(0034293)
|
Clinton Stimpson
|
2013-10-30 10:20
|
|
Oh, OK. So the difference from what I've seen before is that it kept the old behavior so there was no need to warn. |
|
|
(0034294)
|
Brad King
|
2013-10-30 10:27
|
|
|
|
(0034385)
|
Brad King
|
2013-11-04 11:36
|
|
|
|
(0036000)
|
Robert Maynard
|
2014-06-02 08:37
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|