[CMake] Handling real-time output from execute_process

frodak17 frodak17 at gmail.com
Fri Dec 21 22:26:19 EST 2018


On Fri, Dec 21, 2018 at 8:30 PM Person Withhats <personwithhats2 at gmail.com>
wrote:

> Hey there!
>
> I'm running a script that downloads some files and untars them. This takes
> a while but it outputs progress. Unfortunately I can't get the output to
> show up in real-time with CMake GUI or CLI.
>
> Current workaround to see output live, loses it in log though......
>     execute_process(COMMAND "cmd" /c "start /wait download_sdks.exe"
>     WORKING_DIRECTORY "${SCRIPT_DIR}"
>     OUTPUT_VARIABLE OUT
>     RESULT_VARIABLE RES)
>
> Exit code is always 0 no matter what I do or how I get this set up. I want
> to see the output as it's running (preferably in same cmake window) and for
> the GUI stop-button to properly stop the script instead of hanging until
> script ends by itself.
>
> Right now I can get the output at the end but after 1.5 hours of
> untarring/etc. I'd be worried if it wasn't just frozen......
>
> This is for windows 10 ofc and the .exe file is PyInstalled. Works fine
> double-clicking (launches terminal/etc.) but Cmake....ugh......
>
> tl;dr script runs and works fine as usual but I can't see output *while*
> it's running instead of after.
>

How about use OUTPUT_FILE instead. Then while CMake is running you can do a
tail -f on the output file in a different window or just check the contents
in notepad. I don’t know what happens if you don’t redirect standard output
from CMake maybe it shows in terminal.

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181221/b9373264/attachment.html>


More information about the CMake mailing list