On 7/29/19 3:22 PM, Dave Milter wrote:
>> Since then all objects in a target can start compiling independently
>> so long as that target does not depend on any targets with custom
>> commands.

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

> Is any way to tell cmake that add_custom_command is have no side effect,
> and OUTPUT is exactly what it produces?

Even if we had that information we don't know what `main.cpp` includes
until after compiling it, by which point it is too late.  It could have
`#include "anything.txt"` for example.  CMake must add these pessimistic
dependencies to ensure a correct build.

The only way to avoid this is to tell CMake that there are no dependencies
for compiling an object file by moving it to an object library that does
not depend on any of the targets with custom commands.

-Brad
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to