[CMake] Flushing CMake STDOUT to avoid jumbled output?
Brad King
brad.king at kitware.com
Tue Apr 14 13:10:03 EDT 2015
On 04/14/2015 12:25 PM, Bartlett, Roscoe A. wrote:
> Is there a way to make CMake flush STDOUT
Not from the CMake language. However, it shouldn't matter.
> This is a problem since I have tests that grep output generated
[snip]
> to point to the inc-- Configuring incomplete, errors occurred!
> lude directories which will bypass any search for
The problem is in cmake/tribits/utils/DriveAdvancedTest.cmake
where the test is run with:
EXECUTE_PROCESS(
${EXEC_CMND}
OUTPUT_VARIABLE TEST_CMND_OUT
ERROR_VARIABLE TEST_CMND_OUT
RESULT_VARIABLE EXEC_RESULT
)
This combines the stdout and stderr into one variable in an
unspecified way. If you want to match test output reliably then
you should capture stdout and stderr in two separate variables:
OUTPUT_VARIABLE TEST_CMND_OUT
ERROR_VARIABLE TEST_CMND_ERR
and perform matching on them separately. This results in more
precise tests because it verifies that the processes produce the
content expected on each pipe.
-Brad
More information about the CMake
mailing list