MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015792 | CMake | CMake | public | 2015-10-15 04:49 | 2016-03-07 09:12 |
Reporter | Pavel Solodovnikov | ||||
Assigned To | |||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | won't fix | ||
Platform | Linux | OS | OS Version | ||
Product Version | CMake 3.4 | ||||
Target Version | Fixed in Version | ||||
Summary | 0015792: Bad escaping of parentheses in POST_BUILD events if Ninja generator used | ||||
Description | CMake generates wrong post-build events if it contains parentheses: they are not escaped at all (e.g., copy some build artefacts to a directory that contains parens). I've attached a small example to reproduce the issue. ================= BEGIN EXAMPLE cmake_minimum_required(VERSION 2.8.11) project(example) add_library(ex abc.cpp) add_custom_command(TARGET ex POST_BUILD VERBATIM COMMAND cp -f "libex.a" "mydir (abc)") ================= END EXAMPLE After running cmake, we can easily observe that parentheses are not escaped properly in post build event: 57 build libex.a: CXX_STATIC_LIBRARY_LINKER__ex CMakeFiles/ex.dir/abc.cpp.o OBJECT_DIR = CMakeFiles/ex.dir POST_BUILD = cd /mnt/sources/work/cmake_parens_test && cp -f libex.a mydir\ (abc) PRE_LINK = : TARGET_COMPILE_PDB = CMakeFiles/ex.dir/ TARGET_FILE = libex.a TARGET_PDB = libex.pdb It leads to build errors since it's not valid shell syntax: FAILED: : && /home/prog/Downloads/cmake-3.4.0-rc1-Linux-i386/bin/cmake -E remove libex.a && /bin/ar qc libex.a CMakeFiles/ex.dir/abc.cpp.o && /bin/ranlib libex.a && cd /mnt/sources/work/cmake_parens_test && cp -f libex.a mydir\ (abc) /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: line 0: `: && /home/prog/Downloads/cmake-3.4.0-rc1-Linux-i386/bin/cmake -E remove libex.a && /bin/ar qc libex.a CMakeFiles/ex.dir/abc.cpp.o && /bin/ranlib libex.a && cd /mnt/sources/work/cmake_parens_test && cp -f libex.a mydir\ (abc)' ninja: build stopped: subcommand failed. It is possible to workaround this by using VERBATIM option in POST_BUILD event, though. Tested with the latest CMake v.3.4.0 rc1 (I just couldn't select it in "Product Version" dropdown list, so I left CMake 3.3.2 there). | ||||
Steps To Reproduce | 1) Extract attached example.tar 2) Run "cmake -G "Ninja" ." inside extracted dir. 3) Examine produced build.ninja file. | ||||
Additional Information | |||||
Tags | CMake, linux, ninja | ||||
Relationships | |||||
Attached Files | cmake_parens_test.tar (10,240) 2015-10-15 04:49 https://public.kitware.com/Bug/file/5542/cmake_parens_test.tar | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-10-15 04:49 | Pavel Solodovnikov | New Issue | |||
2015-10-15 04:49 | Pavel Solodovnikov | File Added: cmake_parens_test.tar | |||
2015-10-15 04:50 | Pavel Solodovnikov | Tag Attached: CMake | |||
2015-10-15 04:50 | Pavel Solodovnikov | Tag Attached: linux | |||
2015-10-15 04:50 | Pavel Solodovnikov | Tag Attached: ninja | |||
2015-10-15 04:52 | Pavel Solodovnikov | Note Added: 0039607 | |||
2015-10-15 08:33 | Brad King | Product Version | CMake 3.3.2 => CMake 3.4 | ||
2015-10-15 08:36 | Brad King | Note Added: 0039608 | |||
2015-10-15 08:36 | Brad King | Status | new => resolved | ||
2015-10-15 08:36 | Brad King | Resolution | open => won't fix | ||
2016-03-07 09:12 | Robert Maynard | Note Added: 0040618 | |||
2016-03-07 09:12 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|