MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0015200 | CMake | CMake | public | 2014-10-09 08:24 | 2015-04-06 09:07 |
|
Reporter | Ray Donnelly | |
Assigned To | | |
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | no change required | |
Platform | Microsoft | OS | Windows | OS Version | 7 64bit |
Product Version | CMake 3.0.2 | |
Target Version | | Fixed in Version | | |
|
Summary | 0015200: Odd quoting issue when mixing single, double and escaped quotes to COMMAND |
Description | Using the following CMakeList.txt:
add_executable (blender blender.c)
set(TARGETDIR_VER "C:/Program Files (x86)/Blender/share/blender/2.72")
add_custom_command(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}'
)
Using any old blender.c (hello world will do)
And either "MSYS Makefiles" or "MinGW Makefiles" generators (actually I suspect any Makefile generator at all), we get badly quoted strings in CMakeFiles/blender.dir/build.make:
/C/cmake-3.0.2-win32-x86/bin/cmake.exe -E echo 'now run: "make install" to copy runtime files and scripts to "C:/Program Files (x86)/Blender/share/blender/2.72'"
It seems that the final ' and " have been swapped, which causes:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"' |
Steps To Reproduce | unzip quote-problem.7z, and from the MSYS2 shell enter:
/c/cmake-3.0.2-win32-x86/bin/cmake.exe -G'MSYS Makefiles'
make
and observe the error message above. |
Additional Information | This happens on the officially release 3.0.2 Windows binary and also on MSYS2's cmake. |
Tags | No tags attached. |
Relationships | |
Attached Files | quote-problem.7z (489) 2014-10-09 08:24 https://public.kitware.com/Bug/file/5271/quote-problem.7z |
|
Issue History |
Date Modified | Username | Field | Change |
2014-10-09 08:24 | Ray Donnelly | New Issue | |
2014-10-09 08:24 | Ray Donnelly | File Added: quote-problem.7z | |
2014-10-09 08:36 | Ray Donnelly | Note Added: 0037011 | |
2014-10-09 08:40 | Brad King | Note Added: 0037013 | |
2014-10-09 08:40 | Ray Donnelly | Note Added: 0037014 | |
2014-10-09 08:44 | Ray Donnelly | Note Added: 0037015 | |
2014-10-09 08:44 | Brad King | Note Added: 0037016 | |
2014-10-09 08:47 | Brad King | Note Added: 0037017 | |
2014-10-09 08:56 | Ray Donnelly | Note Added: 0037018 | |
2014-10-09 09:05 | Brad King | Status | new => resolved |
2014-10-09 09:05 | Brad King | Resolution | open => no change required |
2015-04-06 09:07 | Robert Maynard | Note Added: 0038421 | |
2015-04-06 09:07 | Robert Maynard | Status | resolved => closed |
Notes |
|
(0037011)
|
Ray Donnelly
|
2014-10-09 08:36
|
|
Testing on Linux, we get:
now run: "make install" to copy runtime files and scripts to C:/Program\ Files\ (x86)/Blender/share/blender/2.72 |
|
|
(0037013)
|
Brad King
|
2014-10-09 08:40
|
|
Try using the VERBATIM option to add_custom_command. It causes CMake to add proper escapes to send each argument through the build system shell correctly. |
|
|
(0037014)
|
Ray Donnelly
|
2014-10-09 08:40
|
|
FWIW, I don't think 'MSYS Makefiles' should apply the Windows-y quoting logic, and should instead behave like Linux, but for 'MinGW Makefiles' the quoting does of course need to be applied, just not incorrectly. |
|
|
(0037015)
|
Ray Donnelly
|
2014-10-09 08:44
|
|
VERBATIM does work around this bug, but is there any reason not to fix it? |
|
|
(0037016)
|
Brad King
|
2014-10-09 08:44
|
|
Try something like this:
add_custom_command(
TARGET blender POST_BUILD MAIN_DEPENDENCY blender
VERBATIM COMMAND ${CMAKE_COMMAND} -E echo "now run: \"make install\" to copy runtime files and scripts to ${TARGETDIR_VER}"
) |
|
|
(0037017)
|
Brad King
|
2014-10-09 08:47
|
|
Re 0015200:0037015: The documentation of add_custom_command recommends VERBATIM because it enables correct behavior. However, LOTS of project code was written with hacks to work around the pre-VERBATIM behavior and "fixing" it would break that code by escaping the hacks. We do have the policy mechanism that could be used to fix it in a compatible way but feel that it would still be too disruptive now. |
|
|
(0037018)
|
Ray Donnelly
|
2014-10-09 08:56
|
|
Ok, thanks Brad, that's fine then.
Could the policy mechanism allow the fix to happen around CMake 4 time? (whenever that is), if so, can I request this? |
|
|
(0038421)
|
Robert Maynard
|
2015-04-06 09:07
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|