I'm adding Google's native webrtc library as an external dependency to a CMake project I'm working on. The build process for the webrtc library is rather convoluted but the initial steps are as follows:
- Cloning chromium depot_tools repo
- Adding depot_tools to environment PATH
- Running
fetch --nohooks webrtc
(fetch
tool is found in PATH from previous step) - Several further steps I'll omit as they're not relevant to the question
I can successfully perform all these steps manually from the command line to build the library.
To simply my build process I thought I'd use ExternalProject_Add
with several ExternalProject_Add_Step
s to create a target that my main project can use as a dependency:
ExternalProject_Add(
${PROJECT_NAME}
GIT_REPOSITORY https://chromium.googlesource.com/chromium/tools/depot_tools.git
CONFIGURE_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Add_Step(
${PROJECT_NAME} fetch-webrtc
COMMAND fetch --nohooks webrtc # <--- how to get fetch into PATH?
DEPENDEES mkdir-webrtc
)
...
The problem I have is that when the fetch-webrtc
step is run the fetch
tool is not in the PATH. Now I could "cheat" and change the above step to the following:
ExternalProject_Get_Property(${PROJECT_NAME} SOURCE_DIR)
ExternalProject_Add_Step(
${PROJECT_NAME} fetch-webrtc
COMMAND ${SOURCE_DIR}/fetch --nohooks webrtc # fetch is found!
DEPENDEES mkdir-webrtc
)
This partly solves the issue, however the fetch
command itself requires the depot_tools repo to be in the path as it looks for many files there - thus things ultimately fail.
So how can I go about getting the depot_tools directory into the PATH environment variable (ideally prefixed to the front of all the PATH directories) available for all ExternalProject_Add_Step
steps?