Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ninja generator support #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kilidsch
Copy link

When using ExternalProject, BUILD_BYPRODUCTS is needed when using the ninja generator for ninja to correctly resolve dependencies

This works well for all generators except Ninja. The Ninja build tool sees a rule listing byproduct.txt as a dependency and no rule listing it as an output. Ninja then complains that there is no way to satisfy the dependency and stops building even though there are order-only dependencies that ensure byproduct.txt will exist before its consumers need it. See discussion of this problem in Ninja Issue 760 for further details on why Ninja works this way.

From CMP0058

The above mentions custom commands, but similar is true for ExternalProject, which is used to include some dependencies

BUILD_BYPRODUCTS ...

Specifies files that will be generated by the build command but which might or might not have their modification time updated by subsequent builds. This may also be required to explicitly declare dependencies when using the Ninja generator. These ultimately get passed through as BYPRODUCTS to the build step's own underlying call to add_custom_command(), which has additional documentation.

https://cmake.org/cmake/help/latest/module/ExternalProject.html#command:externalproject_add

I have tested the changes locally on a windows machine with one release and one debug build (note that ninja on windows needs to be used from the developer prompt when using MSVC from outside of Visual Studio)

When using ExternalProject, BUILD_BYPRODUCTS is needed when
using the ninja generator for ninja to correctly resolve dependencies
compare with CMP0058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant