function (nice_list_output)
	set(options )
	set(oneValueArgs OUTVAR)
	set(multiValueArgs LIST)
	cmake_parse_arguments(NLO "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")

	set(unparsed ${NLO_UNPARSED_ARGUMENTS})
	if(unparsed)
		message(FATAL_ERROR "function nice_list_output: unparsed arguments: ${unparsed}")
	endif()

	list(LENGTH NLO_LIST TMP_LEN)
	if("${TMP_LEN}" STREQUAL "1")
		set(${NLO_OUTVAR} ${NLO_LIST})
	else()
		set(${NLO_OUTVAR} "")
		foreach(I RANGE 1 ${TMP_LEN})
			math(EXPR TMP "${TMP_LEN}-${I}")
			math(EXPR I0 "${I}-1")
			list(GET NLO_LIST ${I0} LIST_ITEM)
			if(I GREATER 1)
				if("${TMP}" STREQUAL "0")
					set(${NLO_OUTVAR} "${${NLO_OUTVAR}} and")
				else()
					set(${NLO_OUTVAR} "${${NLO_OUTVAR}},")
				endif()
				set(${NLO_OUTVAR} "${${NLO_OUTVAR}} ${LIST_ITEM}")
			else()
				set(${NLO_OUTVAR} "${${NLO_OUTVAR}}${LIST_ITEM}")
			endif()
		endforeach()
	endif()
	set(${NLO_OUTVAR} ${${NLO_OUTVAR}} PARENT_SCOPE)
#	message("NLO_OUTVAR: ${NLO_OUTVAR}: ${${NLO_OUTVAR}}")
endfunction()

