Notes |
|
(0030811)
|
Brad King
|
2012-08-31 11:47
|
|
The CMake language splits unquoted arguments on ';', not spaces. I do
execute_process(COMMAND ${CMAKE_COMMAND} ...)
all the time with spaces in the path. There must be something more specific about your case. |
|
|
(0030812)
|
David Cole
|
2012-08-31 11:56
|
|
What are your exact steps to reproduce the problem?
Using execute_process or add_custom_command with:
COMMAND ${CMAKE_COMMAND} ...
works without any double quotes.
Let us know how to reproduce the problem you're seeing... |
|
|
(0033493)
|
Chris Vermilion
|
2013-07-07 21:00
|
|
Found this issue Googling a similar problem. I'm not sure if this is the original submitter's situation, but I came across the issue in a custom-generated installation script for an external package built with ExternalProject. Our main CMake process generates a install-some-package.cmake file which is later included. The code to write the install script includes a line like this:
execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ... )
That works fine called directly, but if you first write it to a file and then read it again it breaks, since the space in the expanded variable is treated differently.
I'm not sure if this is really a bug, since it seems like the right thing to do here is escape the command so that the script gets written with "${CMAKE_COMMAND}" rather in its expanded value, but I thought this might shed a little light on the issue. |
|
|
(0033499)
|
Brad King
|
2013-07-08 08:35
|
|
Re 0013506:0033493: Yes, if you're generating a .cmake file to be later loaded it is your responsibility to make sure it is correct syntax. CMake syntax separates arguments by whitespace so if you have an argument with spaces it needs to be quoted. Of course you could also make sure that ${CMAKE_COMMAND} appears literally by using "\$" to avoid expansion of the variable reference in the code that is writing the script. |
|
|
(0033500)
|
Brad King
|
2013-07-08 08:36
|
|
@Jaime Frey: Is the unquoted case that you encountered in code generated by CMake or in a file generated by your own project?
|
|
|
(0037825)
|
Jaime Frey
|
2015-01-26 18:21
|
|
Sorry for the very late reply. At the time, we worked around the problem by renaming the installation path to remove the space. We've re-encountered it this week on a fresh build machine.
The code in question was written by us, following an example we found somewhere inline:
install ( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink source destination)" )
It appears the quoting around execute_process() was causing ${CMAKE_COMMAND} to be broken up into two arguments at the space. The solution I found today is to add some escaped quotes:
install ( CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink source destination)" ) |
|
|
(0037829)
|
Brad King
|
2015-01-27 08:32
|
|
Re 0013506:0037825: Okay, that one valid solution. Another is to escape the dollar sign so that ${CMAKE_COMMAND} is written literally into the install script code for evaluation during install:
install ( CODE "EXECUTE_PROCESS(COMMAND \${CMAKE_COMMAND} -E create_symlink source destination)" )
|
|
|
(0038860)
|
Robert Maynard
|
2015-06-01 08:38
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|