Semicolon (;) in string value of cmake.configureSettings (and potentially elsewhere) gets escaped in resulting CMakeCache.txt.
Let's create a simple example project with a string variable that we set when configuring the project:
demo=`mktemp -d`
cd $demo
# Create CMakeLists.txt
cat <<EOF > CMakeLists.txt
project(demo)
set(LLVM_ALL_PROJECTS "clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;llgo;openmp;parallel-libs;polly;pstl")
set(LLVM_ENABLE_PROJECTS "" CACHE STRING
"Semicolon-separated list of projects to build (${LLVM_ALL_PROJECTS}), or \"all\".")
EOF
# Configure
cmake . -DLLVM_ENABLE_PROJECTS="lldb;clang"
# Grep for resulting line in CMakeCache.txt
grep "LLVM_ENABLE_PROJECTS" CMakeCache.txt
Please notice, that the resulting line looks like this:
LLVM_ENABLE_PROJECTS:STRING=lldb;clang
When I take the above project and configure it in using vscode-cmake-tools I have this cmake.configureSettings in my settings.json:
"cmake.configureSettings": {
"LLVM_ENABLE_PROJECTS": "lldb;clang",
}
Once configured, the resulting line in CMakeCache.txt looks like this (notice the semicolon being escaped):
LLVM_ENABLE_PROJECTS:STRING=lldb\;clang
This line is supposed to look like this IMHO (notice the semicolon not escaped):
LLVM_ENABLE_PROJECTS:STRING=lldb;clang
I did solve the problem myself by using a JSON array instead of a string:
"cmake.configureSettings": {
"LLVM_ENABLE_PROJECTS": ["lldb", "clang", "lld", "compiler-rt", "clang-tools-extra"],
}
Thank you for this great extension!
This should be stated in the documentation. I could make the merge request, but don't have time at the moment to see what other fields are impacted (for example, does this also happen on cmake.configureArgs?).
Most helpful comment
I did solve the problem myself by using a JSON array instead of a string:
Thank you for this great extension!