MantisBT - CMake
View Issue Details
0014964CMakeCMakepublic2014-06-09 10:332016-06-10 14:31
Linus 
Kitware Robot 
normalminoralways
closedmoved 
AppleOSX10.9
CMake 2.8.12.2 
 
0014964: Command line scanning is bad with spaces
If the -D or -C options are used with a space between the flag and the argument after the path to the project, cmake will interpret the argument to the flag as being the intended source directory.
cmake . -D OPTION=VALUE # verbatim, run anywhere
cmake . -C initial-script # idem
Works fine with -DOPTION=VALUE or -Cinitial-script or if the options are placed (with spaces) before the build directory.
No tags attached.
Issue History
2014-06-09 10:33LinusNew Issue
2014-06-09 10:36Rolf Eike BeerNote Added: 0036135
2014-06-09 10:48LinusNote Added: 0036136
2014-07-29 04:53LinusNote Added: 0036487
2014-07-29 09:45Brad KingNote Added: 0036489
2014-07-29 09:45Brad KingStatusnew => backlog
2016-06-10 14:29Kitware RobotNote Added: 0042562
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0036135)
Rolf Eike Beer   
2014-06-09 10:36   
This works fine for me, especially if I follow the correct syntax and specify the path to the source directory last.
(0036136)
Linus   
2014-06-09 10:48   
I am aware that the correct syntax is with the source directory last, but I think that placing options afterwards should either always work or never work, because working only without a space is a rather odd quirk.

It's also not particularly obvious that the source directory has to be the last argument.
(0036487)
Linus   
2014-07-29 04:53   
Bump -- I still think it would be good if CMake were less obtuse about this -- perhaps *consistently* outputting an error message if there's anything else after the source directory, or if the behaviour were at least clearly documented.
(0036489)
Brad King   
2014-07-29 09:45   
Moving to backlog because no one is working on it.

The command-line argument handling needs a non-trivial cleanup anyway to do things like complain about unrecognized options. This issue is just one of symptoms.
(0042562)
Kitware Robot   
2016-06-10 14:29   
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.