[CMake] CTest: Handle output of a custom CTEST_CONFIGURE_COMMAND

Matějů Miroslav, Ing. Mateju.Miroslav at azd.cz
Wed Mar 16 06:50:03 EDT 2016


Hi,

I am using CTest to encapsulate automatic build and testing of a microcontroller software and report results to CDash. This process generally works but I am facing a problem with handling configure errors within CTest and CDash.

Configure phase involves several tools besides CMake, so I have created a batch-file and use it as a custom CTEST_CONFIGURE_COMMAND:

    set(CTEST_CONFIGURE_COMMAND "$ENV{SCRIPT_FOLDER}/configure.bat")

When one of configure tools fails, configure.bat exits with a positive return value using 'exit /b %ERRCODE_TOOL%'.

If I run configure.bat directly, I can check the desired value is returned by running 'echo %ERRORLEVEL%' after the script finishes.

However, when the script is called from CTest script using 'ctest_configure(RETURN_VALUE configure_failed)', the variable configure_failed does not prevent building, although following code is used:

    if   ($ENV{DO_BUILD} AND NOT configure_failed)
      ctest_build(RETURN_VALUE build_failed)
    endif($ENV{DO_BUILD} AND NOT configure_failed)

Also the report of configure phase in CDash contains:

    Configure Command: D:/checkout/integration/script//configure.bat
    Configure Return Value: 0
    Configure Output:

    [configure] ---------- XMLConf ----------
    error: Cannot find CFG overlay XML file
    [configure] Error: XMLConf failed.

CDash reports 0 errors and 0 warnings for the configure phase, although the last two lines of configure.bat output go to stderr.

What can I do to get configure errors properly reported in my environment?

I use Windows 7 64-bit and native CMake 3.5.0.

Thanks in advance for any help!

Miroslav Matějů


More information about the CMake mailing list