In CMake how do turn a multi line output of a command into a list?
问题 I want to do do something like this execute_process( COMMAND bash -c "git --git-dir ${CMAKE_SOURCE_DIR}/.git ls-files" OUTPUT_VARIABLE TRACKED_FILES) add_custom_target(all_file_project SOURCES ${TRACKED_FILES}) And the command itself seems to work as expected but the generated variable "TRACKED_FILES" contains only one logical entry (one multi line string) rather than a list of files. Can I somehow turn a string containing multiple lines separated by a newline ("\n") into a list in CMake? 回答1