View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0016093CMakeCMakepublic2016-05-04 10:212016-06-10 14:21
ReporterAndreas Schuh 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformApple MacOSOS XOS Version10.11.4
Product VersionCMake 3.5.2 
Target VersionCMake 3.6Fixed in VersionCMake 3.6 
Summary0016093: Clarify documentation of --build as a separate command mode
DescriptionThe following results in an error as if I'd specified a subdirectory underneath the current build directory. Changing the order of --build and --target options works as expected, though. Just "--build ." followed directly by "--target" gives this error.

cmake --config Release --build . --target apidoc
CMake Error: The source directory "/Users/as12312/Software/BASIS/Xcode/apidoc" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.


cmake --config Release --target apidoc --build .
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0041024)
Andreas Schuh (reporter)
2016-05-04 10:24

Actually, the error message seems to suggest that the argument "--target" is taken as the argument of the "--build" option, ignoring the dot ".". Then the name of the target following the "--target" option becomes the positional argument of "cmake" which is the source directory.
(0041026)
Brad King (manager)
2016-05-05 08:33

The command mode is "cmake --build <dir>" followed by other options. This is just like "git clone" has options that must come after "clone" and not before. This is shown in the documented command synopsis:

 https://cmake.org/cmake/help/v3.5/manual/cmake.1.html [^]
 cmake --build <dir> [<options>] [-- <build-tool-options>...]
(0041027)
Andreas Schuh (reporter)
2016-05-05 08:36

Fair enough. Although there is an important difference between "git clone" and "cmake --build". The first makes it clear the "clone" is a subcommand (cf. Python argparse subcommand) while "--build" suggest it to be just an option... obviously not to be changed now, but I think you see where the assumption that the order of arguments should not matter comes from.
(0041038)
Antonio (reporter)
2016-05-10 04:19

I understand the synopsis shows that --build, -E and --find-package have to be given as first, but I think then it should be made explicit in the option description and/or cmake should give a clear error if such an option doesn't appear as first. In fact, calling them "options" makes things ambiguous: staying with the comparison with "git clone", they should be called "commands".
(0041039)
Brad King (manager)
2016-05-10 09:47

Re 0016093:0041038: Yes, fixed:

Help: Document `cmake --find-package` as a separate command mode
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d4faed2f [^]

Help: Document `cmake --build` as a separate command mode (0016093)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3e503fe1 [^]
(0041047)
Antonio (reporter)
2016-05-11 03:47

Great, thank you!
(0041177)
Kitware Robot (administrator)
2016-06-10 14:21

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.

 Issue History
Date Modified Username Field Change
2016-05-04 10:21 Andreas Schuh New Issue
2016-05-04 10:24 Andreas Schuh Note Added: 0041024
2016-05-05 08:33 Brad King Note Added: 0041026
2016-05-05 08:33 Brad King Status new => resolved
2016-05-05 08:33 Brad King Resolution open => won't fix
2016-05-05 08:36 Andreas Schuh Note Added: 0041027
2016-05-10 04:19 Antonio Note Added: 0041038
2016-05-10 09:47 Brad King Note Added: 0041039
2016-05-10 09:47 Brad King Assigned To => Brad King
2016-05-10 09:47 Brad King Resolution won't fix => fixed
2016-05-10 09:47 Brad King Fixed in Version => CMake 3.6
2016-05-10 09:47 Brad King Target Version => CMake 3.6
2016-05-10 09:47 Brad King Summary Order of --build and --target "cmake" command options matters => Clarify documentation of --build as a separate command mode
2016-05-11 03:47 Antonio Note Added: 0041047
2016-06-10 14:21 Kitware Robot Note Added: 0041177
2016-06-10 14:21 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team