My project depends on external libraries such as Boost, GTest, and GMock. I am providing a facility wherein a user can pass a variable BINARY_ROOT from the command line, and if FindBoost, FindGTest etc fail, it will automatically decompress the appropriate binary, compile, and install it, then try FindBoost etc again.
Each library requires multiple steps to be executed one after the other. For example, boost requires b2.exe to be produced first. I am able to successfully build it with the command
execute_process(
COMMAND cmd /C “${ScriptCmd}”
WORKING_DIRECTORY “${WorkingDirectory}”
COMMAND_ECHO STDOUT
)
I then issue
execute_process(
COMMAND “${FullB2Cmd}”
WORKING_DIRECTORY “${BootstrapDir}”
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
Unfortunately, this second command fails with:
‘C:\DemoBinaries\Temp\boost_1_81_0\b2 --prefix=C:\DemoPackages\Boost variant=debug variant=release --build-type=complete install’
CMake Error at cmake/boost_utility.cmake:16 (execute_process):
execute_process error getting child return code: The system cannot find the
file specified
The console output clearly shows that the first command executes quite successfully, but it seems CMake is not waiting for it to finish the compilation process. How can I make CMake wait for execute_process to finish before executing the next command?