Skip to content

message: Add `CHECK_xxx` types

Alex Turbov requested to merge zaufi/cmake:feature/testing-message-types into master

Nowadays to report tests executed the STATUS type messages are widely used. That way is error-prone and violates the don't-repeat-yourself (DRY) principle.

To address that issues the new message types were added.

The CMake-time tests typically look like this:

    message(STATUS "Looking for `libfoo.h`")
    ...
    if(BLAH_BLAH)
        message(STATUS "Looking for `libfoo.h` - found")
    else()
        message(STATUS "Looking for `libfoo.h` - not found")
    endif()

With the added message types:

    message(CHECK_START "Looking for `libfoo.h`")
    ...
    if(BLAH_BLAH)
        message(CHECK_PASS "found")
    else()
        message(CHECK_FAIL "not found")
    endif()

The output is backward compatible with the old way, but adds more semantic to the code which also could be used by the tool described in #19438.

The second commit introduces this feature to the existed CMake modules.

Topic-rename: message-check-types

Edited by Alex Turbov

Merge request reports