On 28.04.2015 16:50, James Bigler wrote:
Why are we making the restriction more restrictive than it needs to
be? We only need this for multiple targets and not within a single
target.
I wasn't aware of that use case and I misdiagnosed the underlying issue
as well.
The issue isn't having multiple custom commands listing the same
MAIN_DEPENDENCY but rather having more than one target refer to a source
file that is listed as a MAIN_DEPENDENCY.
The policy will likely have to be removed or replaced.
Ideally what should happen is:
1. MAIN DEPENDENCY issues cross targets should automatically be
downgraded to DEPENDENCY with a warning.
I'm also curious why specifying MAIN DEPENDENCY in make file
generators has any special effect since according the documentation
there be no functional difference. It seems like this is more a bug in
how MAIN DEPENDENCY is being handled. Using warnings and errors to
correct this seems a bit like the wrong solution.
It seems to be like this ...
a) A custom command (with OUTPUT) without MAIN_DEPENDENCY attaches the
command to the OUTPUT source file (or rather rule file associated with
the first output).
b) A custom command (with OUTPUT) with MAIN_DEPENDENCY attaches the
command to the input (MAIN_DEPENDENCY) source file.
This so far is generic and not generator specific.
For every target the makefile generator iterates over all source files
and emits their attached commands.
For case a) this breaks if an OUTPUT is listed in more than one target.
For case b) this breaks if a MAIN_DEPENDENCY is listed in more than one
target.
This also means that MAIN_DEPENDENCY can probably not be downgraded to
DEPENDENCY automatically since existing projects might not list both
output and input in their targets.
Nils
--
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-developers