> . The Ninja generator has loosened the dependencies of object
> compilation. Object compilation now depends only on custom targets and
> custom commands associated with libraries on which the object's target
> depends and no longer depends on the libraries themselves. Source
> files in dependent targets may now compile without waiting for their
> targets' dependencies to link.

Correct.

> We have a few cases where the object compilation really does depend on
> the TARGET_FILE itself, e.g.
> 1. An RC compiler embedding the resulting file of a custom target (I
> think this one may still work, since custom targets appear to have
> been exempted from the change)

Correct, though this issue:

    https://gitlab.kitware.com/cmake/cmake/issues/17097

requests that that be fixed as well (though that is backwards
compatible since the solution will likely involve ).

> 2. MSVC's #import construct which needs the indirect dependencies
> (dependencies of the #import-ed dependency) be registered, which is
> handled as part of the target using add_custom_command(TARGET foo
> POST_BUILD COMMAND ...)

So there's an issue here that there's a dependency between your build
rules which CMake doesn't know about (though I don't know #import well
enough, the docs don't state where the information *goes*). When adding
this custom command, you may use the `BYPRODUCTS` argument (introduced
in 3.2.0) to let CMake know what's going on here. It only affects Ninja,
but the other generators do target-level dependencies anyways. That
output can then be depended on via `OBJECT_DEPENDS` and the dependency
should link up properly.

If it instead gets registered somewhere in the aether (as far as CMake
is concerned), adding support for generator expressions to
`OBJECT_DEPENDS` so that `$<TARGET_FILE:tgt>` may be used there would be
the next solution.

Making `POST_BUILD` write out a stamp file would also work and then
using `OBJECT_DEPENDS` on that would also work.

--Ben
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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

Reply via email to