Imagine I have the following string :
set(SEXY_STRING \"I love CMake\")
then I want to obtain SEXY_LIST
from SEXY_STRING
You can use the separate_arguments command.
cmake_minimum_required(VERSION 2.6)
set(SEXY_STRING "I love CMake")
message(STATUS "string = ${SEXY_STRING}")
# string = I love CMake
set( SEXY_LIST ${SEXY_STRING} )
separate_arguments(SEXY_LIST)
message(STATUS "list = ${SEXY_LIST}")
# list = I;love;CMake
list(LENGTH SEXY_LIST len)
message(STATUS "len = ${len}")
# len = 3