Notes |
|
(0032365)
|
Dave Abrahams
|
2013-02-23 01:42
|
|
|
|
(0032370)
|
Brad King
|
2013-02-25 08:34
|
|
The open paren is being treated as the argv[0] of a single command line.
Without the VERBATIM option quoting of special characters is not done consistently (here 'verbatim' means that we quote the value to get it through to the actual command's argv array as CMake sees it). Adding the option I get
"(" A || B ")" && C
which at least is consistent with left and right parens. The shell operators are not quoted as they are treated as special cases already by VERBATIM due to previous such requests.
These kinds of shell expressions are not portable AFAIK. I suggest writing
VERBATIM COMMAND sh -c "( A || B ) && C"
in the custom command instead, at least to work around this.
The list of special exceptions for shell operators is here:
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v2.8.10.2#l2948 [^]
Try adding "(" and ")" to that list. |
|
|
(0032375)
|
Dave Abrahams
|
2013-02-25 09:42
|
|
1. Is that kind of shell expression any less portable than the availability of sh?
2. Not sure to whom the "Try adding…" advice is directed, but I don't plan to rebuild cmake for this one
3. Aside: I noticed that multiple COMMANDs get joined up by cmake with &&, at least on *nix. This can result in line lengths that would surely blow up CMD.EXE. The lack of parens around each clause means the user has to be aware of how cmake will construct the full command. |
|
|
(0032376)
|
Brad King
|
2013-02-25 10:02
|
|
Re 0013946:0032375:
(1) No, but sh should be available anywhere you can use shell expressions and you don't need a new CMake to use it. I've seen projects go as far as using find_program to get sh, or just hard-code /bin/sh.
(2) The advice was directed to you to see if the fix is sufficient. Perhaps this fix will uncover another problem your project exposes which could then be reported too.
(3) Multiple commands are handled differently by different generators. If you don't put in your own shell expressions then you don't need to know how CMake combines them. Using "sh -c" will hide the operators inside a string argument and CMake will escape the command after -c so sh sees it cleanly (with VERBATIM). |
|
|
(0032383)
|
Dave Abrahams
|
2013-02-26 10:20
|
|
I appreciate your efforts, Brad, but we found a different approach. |
|
|
(0032384)
|
Brad King
|
2013-02-26 10:42
|
|
Okay, sending to backlog for now and updating summary text.
|
|
|
(0042234)
|
Kitware Robot
|
2016-06-10 14:28
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|