function(print_list var) set(CMAKE_MESSAGE_INDENT "") set(_var_str "") foreach(item IN LISTS ${var}) set(_var_str "${_var_str}\n ${item}") endforeach() if ("${ARGN}" STREQUAL "VERBOSE") message(VERBOSE "***${var}:${_var_str}") else() message("***${var}:${_var_str}") endif() endfunction()