CMake command-line "bug?"

3,080 views
Skip to first unread message

David Abrahams

unread,
Aug 22, 2010, 10:58:04 PM8/22/10
to Ryppl Developers

Hi Kitware guys,

When trying to debug some code I issued the command

cmake --build .

and cmake silently ignored "--build"

It looks like cmake takes the last argument to be the source
directory, no matter what comes before it.

Am I missing something, or is that kinda busted? Seems like it should
tell me to specify a source directory...

Thanks,

--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

David Cole

unread,
Aug 23, 2010, 5:45:01 AM8/23/10
to rypp...@googlegroups.com
Hmmmm...

"cmake --build ." is intended to be used from an already-configured build tree.

Did you run it in the source tree?
Or in a build tree that was not configured yet?

Sounds like we need better error checking of the "cmake --build ." command line...


Thanks for the report,
David Cole

David Abrahams

unread,
Aug 23, 2010, 6:58:01 AM8/23/10
to rypp...@googlegroups.com

On Aug 23, 2010, at 1:45 AM, David Cole wrote:

> Hmmmm...
>
> "cmake --build ." is intended to be used from an already-configured build tree.
>
> Did you run it in the source tree?
> Or in a build tree that was not configured yet?

I don't remember, sorry.

> Sounds like we need better error checking of the "cmake --build ." command line...
>
>
> Thanks for the report,
> David Cole

NP

--
David Abrahams
BoostPro Computing
http://boostpro.com


David Cole

unread,
Aug 23, 2010, 11:34:42 PM8/23/10
to rypp...@googlegroups.com
On Sun, Aug 22, 2010 at 10:58 PM, David Abrahams <da...@boostpro.com> wrote:


Hi Kitware guys,

When trying to debug some code I issued the command

    cmake --build .

and cmake silently ignored "--build"

OK. So I cannot reproduce this, using cmake 2.8.2 on my Mac.

If I try "cmake --build ." in a source tree, I get a message:
Error: could not load cache

If I try "cmake --build ../src" in a build tree *before configuring*, I get the same message:
Error: could not load cache

If I try "cmake --build ." in a build tree after configuring the build tree with "cmake ../src", it builds, like it's supposed to:
Scanning dependencies of target echoargs
[100%] Building C object CMakeFiles/echoargs.dir/echoargs.c.o
Linking C executable echoargs
[100%] Built target echoargs


If I then remove the add_executable from that CMakeLists.txt file and re-configure....
Voila, no output from "cmake --build ." because nothing is built.


Can you reproduce this?
What's the output? (I assume exactly nothing, which equates to your "silently ignores"...)
Perhaps silence means there's nothing whatsoever to build in that particular build tree -- maybe you were building a project with no libraries or executables?


HTH,
David C.

Dave Abrahams

unread,
Aug 24, 2010, 2:10:53 PM8/24/10
to rypp...@googlegroups.com
On Mon, Aug 23, 2010 at 7:34 PM, David Cole <david...@kitware.com> wrote:
> On Sun, Aug 22, 2010 at 10:58 PM, David Abrahams <da...@boostpro.com> wrote:
>>
>>
> Can you reproduce this?
> What's the output? (I assume exactly nothing, which equates to your
> "silently ignores"...)

No, I meant that the error message didn't seem to tell me what was
wrong with my command line (which I thought was missing an argument).
I was obviously confused. I think if there's a real bug it's in
documentation, naming, and error messages.

1. The documentation I can find for --build is at best quite sparse.
Since I was starting with someone else's code, it wasn't there because
I knew I needed it and added it myself; it was already present.
Trying to figure out what it did was difficult for me in part because
of...

2. The term "Project binary directory" used in those docs does not
sound to me like it means what it is, so I misinterpreted what was
supposed to come next. For me, the term "(configured) CMake build
directory" would be better.

3. cmake --help says:

Usage

cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>

Options
...
--build <dir> = Build a CMake-generated project binary tree.

which doesn't make it at all clear that when you use --build <dir>
there's no additional <path-to-xxx> required on the command line

4. "Could not load cache" is a terrible alias for "I looked in the
argument to --build (`.') and it doesn't appear to be a configured
build directory"

David Cole

unread,
Aug 24, 2010, 2:22:46 PM8/24/10
to rypp...@googlegroups.com

I agree.

On all 4 points.

I've filed a bug that will hopefully become an action item to make things better. :-)
http://public.kitware.com/Bug/view.php?id=11166


Thanks again,
David C.

Reply all
Reply to author
Forward
0 new messages