Skip to content

ExternalProject: If BUILD_ALWAYS is set, always install

The BUILD_BYPRODUCTS option causes the ExternalProject's build step in to have restat = 1, so its "always out-of-date" status caused by BUILD_ALWAYS does not propagate to the install step. Mark the latter step as explicitly always out-of-date too.

Original Description

When using the Ninja generator and the BUILD_ALWAYS option for ExternalProject_Add, ninja <name-of-externalproject> will rebuild the external project but not reinstall it. The main project then still uses the previously installed version.

With the default Make generator, make <name-of-externalproject> does reinstall the external project. I don't know why.

This patch modifies the install step so it resembles the build step for external projects: When BUILD_ALWAYS is enabled, the install step is always executed.

I applied this patch locally using spack and ninja <name-of-externalproject> now always reinstalls the external project, similarly to the behavior of make.

Fixes: #23820 (closed)
Topic-rename: ExternalProject-BUILD_ALWAYS-install

Edited by Brad King

Merge request reports