2017-05-25 14:33:16 +08:00
# vcpkg_execute_required_process
2021-03-11 01:56:07 +08:00
The latest version of this document lives in the [vcpkg repo ](https://github.com/Microsoft/vcpkg/blob/master/docs/maintainers/vcpkg_execute_required_process.md ).
2021-03-01 05:17:19 +08:00
2017-05-25 14:33:16 +08:00
Execute a process with logging and fail the build if the command fails.
## Usage
```cmake
vcpkg_execute_required_process(
COMMAND < ${PERL}> [< arguments > ...]
WORKING_DIRECTORY < ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg>
LOGNAME < build- $ { TARGET_TRIPLET } -dbg >
2020-11-21 02:29:25 +08:00
[TIMEOUT < seconds > ]
[OUTPUT_VARIABLE < var > ]
[ERROR_VARIABLE < var > ]
2023-01-10 03:13:59 +08:00
[SAVE_LOG_FILES < relative-path > [ALIAS < unique-alias > ] [< relative-path > ...]]
2017-05-25 14:33:16 +08:00
)
```
## Parameters
2019-08-29 04:49:29 +08:00
### ALLOW_IN_DOWNLOAD_MODE
2021-02-10 07:53:36 +08:00
Allows the command to execute in Download Mode.
2019-08-29 04:49:29 +08:00
[See execute_process() override ](../../scripts/cmake/execute_process.cmake ).
2017-05-25 14:33:16 +08:00
### COMMAND
The command to be executed, along with its arguments.
### WORKING_DIRECTORY
The directory to execute the command in.
### LOGNAME
The prefix to use for the log files.
2020-11-21 02:29:25 +08:00
### TIMEOUT
Optional timeout after which to terminate the command.
### OUTPUT_VARIABLE
Optional variable to receive stdout of the command.
### ERROR_VARIABLE
Optional variable to receive stderr of the command.
2017-05-25 14:33:16 +08:00
This should be a unique name for different triplets so that the logs don't conflict when building multiple at once.
2022-07-19 04:21:36 +08:00
### SAVE_LOG_FILES
Optional files to be moved from the working directory to `${CURRENT_BUILDTREES_DIR}` .
The files are copied even if the process failed.
This helps to collect relevant log files in CI setups.
2023-01-10 03:13:59 +08:00
The target filename is constructed from the `LOGNAME` parameter and the parameter of the `ALIAS` keyword following the source path.
If `ALIAS` is absent, the target filename is constructed from the `LOGNAME` parameter, the source filename,
and the suffix `.log` if the source filename doesn't already end with this suffix.
2017-05-25 14:33:16 +08:00
## Examples
2023-01-10 03:13:59 +08:00
* [boost-build ](https://github.com/Microsoft/vcpkg/blob/master/ports/boost-build/portfile.cmake )
2017-05-25 14:33:16 +08:00
* [ffmpeg ](https://github.com/Microsoft/vcpkg/blob/master/ports/ffmpeg/portfile.cmake )
2023-01-10 03:13:59 +08:00
* [qt5-base ](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5-base/cmake/configure_qt.cmake )
* [vcpkg-cmake ](https://github.com/Microsoft/vcpkg/blob/master/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake )
2017-05-25 14:33:16 +08:00
## Source
2021-03-01 05:17:19 +08:00
[scripts/cmake/vcpkg\_execute\_required\_process.cmake ](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_execute_required_process.cmake )