CMAKE_MESSAGE_INDENT

在版本 3.16 中加入。

message() 命令會將此列表中的字串連接起來,對於日誌等級為 NOTICE 及以下的等級,它會將結果字串前置到訊息的每一行。

範例

list(APPEND listVar one two three)

message(VERBOSE [[Collected items in the "listVar":]])
list(APPEND CMAKE_MESSAGE_INDENT "  ")

foreach(item IN LISTS listVar)
  message(VERBOSE ${item})
endforeach()

list(POP_BACK CMAKE_MESSAGE_INDENT)
message(VERBOSE "No more indent")

結果會產生以下輸出

-- Collected items in the "listVar":
--   one
--   two
--   three
-- No more indent