Proposal: Introduce `being_check`/`end_check`
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.
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()
CMake has quite a lot of similar code. It duplicates the intro message 3 times. The checking result messages also vary a lot:
Also, using capitalized words looks a bit inconsistent to me.
begin_check("Looking for `libfoo.h`") ... end_check(FOO_FOUND)
I see the following topics to discuss:
- Is it worth to add dedicated commands? Personally, I think it is...
- Need some "better" names to follow CMake's tradition to have pairs
- Checking results are not only
not-found-- how to give a user ability to print whatever he wants?
- What is the log-level of the message printed by
begin_check? Is it
STATUS? IMO, having a dedicated log-level could help to future extensions (like one described in #19438) to better understand semantic of the message printed.
- smth else?