[CMake] Separating spaces are escaped by JOIN generator expression

Andrey Pokrovskiy wonder.mice at gmail.com
Tue Dec 16 17:09:15 EST 2014


Let's say:
set(WORDS "cat" "dog")
and then:
"<JOIN:${WORDS}, >"
which will produce "cat\ dog" instead of "cat dog".
Looks like a bug to me.

Minimal example to reproduce the issue.

File - CMakeLists.txt:

cmake_minimum_required(VERSION 3.1)

project(escape_me_not)

set(WORDS "cat" "dog")

add_custom_command(OUTPUT cage.zip COMMAND zip cage.zip "<JOIN:${WORDS}, >")

add_custom_target(escape_me_not ALL DEPENDS cage.zip)

File - cat:
A cat

File - dog:
A dog

After calling cmake in CMakeFiles/escape_me_not.dir/build.make:

zip cage.zip cat\ dog

After calling make:

zip warning: name not matched: cat dog

Does any workaround exists for that? Should I file a bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141216/9d2a1f71/attachment.html>


More information about the CMake mailing list