CMake: Output a list with delimiters

cmake

Solution

Enclose the dereferenced variable in quotes.

set(my_list a b c d)
message("${my_list}")

Outputs

a;b;c;d

Problem

By default, CMake outputs lists without delimiters, eg ``` set(my_list a b c d) message(${my_list}) ``` Outputs ``` abcd ``` How can you (easily) make CMake output something like what is actually stored? ``` a;b;c;d ``` (A typical use case is for outputting a list of search paths)

Original source