[CMake] How to deal with incompatible changes in interface of target_link_libraries()?

Marcel Loose loose at astron.nl
Thu Aug 21 03:29:20 EDT 2014


On 20/08/14 22:50, Alexander Neundorf wrote:
> On Tuesday, August 12, 2014 09:06:13 Brad King wrote:
> ...
>> FYI, the only intended use case for setting a policy to OLD is to
>> quiet warnings in a maintenance branch of an existing release.
>> Some day support for OLD behavior of some policies may be dropped,
>> so all project development moving forward should set the policy
>> to NEW.
> Fixing a warning may make the project require the newer cmake version.
> E.g. if MyProject requires cmake 2.8.10, and there is a new policy in 3.0.0, 
> which generates a warning, a developer using cmake 3.0.0 may see the warning 
> and fix it, but by that he may have broken the build for the required 2.8.10 
> and actually now 3.0.0 is required.
>
> Alex
That's exactly the problem I keep running into. I want my project to be
compatible with any CMake 2.8.x, but also want it to run warning-free
with newer CMake versions, without having to resort to -Wno-dev. AFAIK
that can only be accomplished by setting some policies temporarily to
OLD. However, wrapping target_link_libraries() in a macro that
temporarily sets CMP0022 to OLD failed, due to scoping issues :(

Cheers,
Marcel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loose.vcf
Type: text/x-vcard
Size: 292 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140821/b959505e/attachment.vcf>


More information about the CMake mailing list