[CMake] Execution order

Chris Hillery chillery-cmake at lambda.nu
Fri Sep 17 06:48:53 EDT 2010


On Fri, Sep 17, 2010 at 3:22 AM, David Aldrich <David.Aldrich at eu.nec.com>wrote:

>  Hi Chris
>
>
>
> Thanks for your reply.
>
>
>
> >The message() and file(REMOVE) commands will be executed when you run
> CMake.
>
> >The command to generate the .cpp file won't be executed until you run
> make.
>
>
>
> I don’t think I have ‘got’ CMake yet. I am now definitely confused!
>
>
>
> During normal development, i.e. when the CMakeLists.txt files are complete,
> do I execute CMake or make to build the app?
>

Both. CMake is a Makefile generator; it's more akin to autoconf. Once you've
run cmake once, you'll run "make" whenever you need to recompile.



> If the answer is ‘make’, what is the point of functions such as message()
> and file() only working when I execute CMake?
>

There's lots of things you can do at configuration time that might require
moving files around or outputting messages, such as creating local config.h
files and the like. Our project's CMakeLists comprise thousands of lines, so
have status output is a necessity!

>
>
> I am struggling with the online CMake documentation. The API is well
> defined, but there seems to be description of CMake concepts. Some more
> words would be helpful!
>

Yeah, documentation is the #1 downside to CMake. It can do many marvelous
things - its integration with CTest to run test suites is a biggie. But the
learning curve is not trivial, and it's much steeper than it needs to be due
to lack of documentation.

The CMake Book is nice to have, although IMHO still not totally complete.
There is a lot of good info in the CMake FAQ, though:

http://www.cmake.org/Wiki/CMake_FAQ

>
>
> > Wouldn't it make more sense to generate the source file into the binary
> directory and just leave it there?
>
>
>
> Yes, that’s a good point. I will look at doing it that way. My only
> argument against it is that I will have to configure svn to ignore that
> source file.
>

No, you shouldn't have to, unless you're using in-source builds which is
very strongly deprecated. Once you've gotten used to out-of-source builds
you'll never want to go back. Read section 3 of the FAQ about out-of-source
builds.

Good luck,
Ceej
aka Chris Hillery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100917/2db60aff/attachment.htm>


More information about the CMake mailing list