On Tuesday 12 February 2013, Brad King wrote:
> On 02/12/2013 01:47 PM, Alexander Neundorf wrote:
...
> > 1) fail immediately in the targets file if a referenced target does not
> > exist yet. If imported targets would be new, I would do this. But since
> > they already exist for some time, there are most probably projects where
> > the order of find_package() does not take the dependencies into account,
> > so they build now, but would fail at cmake time then. Would that be
> > acceptable ?
> 
> This is the same as your previous proposal #1.  I accepted it already but
> require the policy for compatibility.

Yes, I know, but IMO with the compatibility here it does not make much sense.
Even with updating cmake people will still run into link errors (and probably 
ignore the cmake warnings).
 
> > 2) Collect the referenced imported targets and check later whether they
> > all have been imported, and error out if not.
> > I'm not completely sure when "later" is.
> > First I thought at the end of the configure-step, but since imported
> > targets do not have global scope, I think this has to be done per
> > directory. So I could do this check in some way at the end of processing
> > a CMakeLists.txt, i.e. before leaving a directory.
> 
> This may be a better option with some C++-side support because it will not
> require projects to change an already-working out-of-order import.  It
> would also potentially allow circular dependencies to work.  One could
> define a directory property that targets files can populate.  It is simply
> a list of target names that must exist by the time the directory is done:
> 
>  set_property(DIRECTORY APPEND PROPERTY REQUIRED_TARGETS ...)
> 
> CMake can read this property at the end of a directory and produce an
> error if it is not satisfied.

A first try is now on stage in the ConfigFileTargetChecks4 branch.
Tests and docs are still missing, error messages are not good yet, etc., but  
it should basically work.
Please have a look at it, especially at the last commit (c80d330).

Alex
--

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