add_custom_command with multpile commands when first fails

Given:

add_custom_command(
    COMMAND c1
    COMMAND c2
    ...
)

Is it necessarily the case that if c1 fails, c2 is not run?

The documentation just says that c1 and c2 are executed in order:

Specify the command-line(s) to execute at build time. If more than one COMMAND is specified they will be executed in order, but not necessarily composed into a stateful shell or batch script.

Commands are chained using &&, so if c1 fails, c2 is not run.

cmake_minimum_required(VERSION 3.20)
project(foo NONE)

add_custom_target(blah)

add_custom_command(
    TARGET blah
    COMMAND true
    COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/ran-true")

add_custom_command(
    TARGET blah
    COMMAND false
    COMMAND touch "${CMAKE_CURRENT_BINARY_DIR}/ran-false")
[0-1->1/1@250.0] cd /home/boeckb/misc/code/sb/cm-cc-chain/build && true && touch /home/boeckb/misc/code/sb/cm-cc-chain/build/ran-true && cd /home/boeckb/misc/code/sb/cm-cc-chain/build && false && touch /home/boeckb/misc/code/sb/cm-cc-chain/build/ran-false
FAILED: CMakeFiles/blah.util 
cd /home/boeckb/misc/code/sb/cm-cc-chain/build && true && touch /home/boeckb/misc/code/sb/cm-cc-chain/build/ran-true && cd /home/boeckb/misc/code/sb/cm-cc-chain/build && false && touch /home/boeckb/misc/code/sb/cm-cc-chain/build/ran-false
ninja: build stopped: cannot make progress due to previous errors.

In fact, it seems that custom commands all attached to the same target get &&'d together.

The “not necessarily composed into a stateful script” part means that cd and export on variables may not affect future commands.