ExternalProject: Set environment variables

Add the ability to modify the environment of the various steps running
as part of an external project build. This specifically adds the ability
to set them on the configure , build , install, and test steps, as well
as exposing the `ENVIRONMENT_MODIFICATION` keyword arguments to
`ExternalProject_Add_Step`, allowing customization of the environment of
custom steps.

The values of the environment variable respect the `LIST_SEPARATOR`.

Fixes: #26963
This commit is contained in:
Evan Wilde
2025-07-22 13:13:23 -04:00
committed by Brad King
parent ff21c3f78a
commit e301cbffcc
11 changed files with 363 additions and 1 deletions
@@ -1896,6 +1896,7 @@ macro(_ep_get_add_keywords out_var)
# Configure step options
#
CONFIGURE_COMMAND
CONFIGURE_ENVIRONMENT_MODIFICATION
CMAKE_COMMAND
CMAKE_GENERATOR
CMAKE_GENERATOR_PLATFORM
@@ -1910,6 +1911,7 @@ macro(_ep_get_add_keywords out_var)
# Build step options
#
BUILD_COMMAND
BUILD_ENVIRONMENT_MODIFICATION
BUILD_IN_SOURCE
BUILD_ALWAYS
BUILD_BYPRODUCTS
@@ -1918,12 +1920,14 @@ macro(_ep_get_add_keywords out_var)
# Install step options
#
INSTALL_COMMAND
INSTALL_ENVIRONMENT_MODIFICATION
INSTALL_BYPRODUCTS
INSTALL_JOB_SERVER_AWARE
#
# Test step options
#
TEST_COMMAND
TEST_ENVIRONMENT_MODIFICATION
TEST_BEFORE_INSTALL
TEST_AFTER_INSTALL
TEST_EXCLUDE_FROM_MAIN