Alexander Neundorf wrote:

> On Monday 11 February 2013, Brad King wrote:
>> On 02/10/2013 10:14 AM, Alexander Neundorf wrote:
>> > 1) either put a check for the required targets in the generated targets
>> > file, and make find_package() fail by setting foo_FOUND to FALSE. This
>> > should be relatively straightforward to implement, and needs only code
>> > in the generated targets file. This is good.
>> 
>> I like this approach better than the second one also.
>> 
>> > On the downside, this will probably make the cmake
>> > run fail for (some ?) projects where it currently succeeds, although
>> > they do not take the dependency order into account when searching
>> > packages.
>> 
>> I think we can add a policy for this.  If not set, warn and use OLD.
>> If OLD, silently accept the missing targets.  If NEW, error.
> 
> So the exported targets file should do something like the following ?
> 
> set(failWithError FALSE)
> cmake_policy(GET CMP00xy POLICY_SET_TO_NEW)
> if("${POLICY_SET_TO_NEW}" STREQUAL "NEW")
>    set(Foo_FOUND FALSE);
>    set(Foo_NOT_FOUND_MESSAGE "Foo not found because some target is
>    missing")
> else()
>    message(STATUS "Foo may not work because some imported target is
>                    currently still missing")
> endif()
> 

You may also want to cherry-pick 3c84b519260398adef95a0e08f268e93430ccaf9 
from my clone to get the policy warning in the cmake language.

Thanks,

Steve.


--

Powered by www.kitware.com

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

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

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

Reply via email to