[CMake] Multiple generators on the same library

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 12 22:12:58 EDT 2007


Alan W. Irwin wrote:
>>> CMake is a great program, once you get to grips with it, more examples
>>> for the documentation would make that much easier.
>
>> however
>> http://www.cmake.org/HTML/RunningCMake.html
>
> The in-source and out-of-source build are documented there, yet that
> documentation is going to lead a lot of users astray since it is not
> mentioned there that if a CMakeCache.txt file is in the source tree (say
> from a previous in-source build) the out-of-source build won't work.
>
> I hope that "feature" is scheduled for removal the next time (2.6?) the
> CMake developers are willing to accept a backwards incompatible change 
> since
> so many stumble over that "feature" despite the FAQ
> (http://www.cmake.org/Wiki/CMake_FAQ#I_run_an_out-of-source_build_but_CMake_generates_in-source_anyway._Why.3F) 
>
> entry warning users about it.
The "feature" is not scheduled for removal.   It is a matter of semantics.

What should this do:

cmake /some/path

If /some/path is not a build tree then the above will create a build 
tree in the current directory.
However if /some/path is a build tree, then cmake will be re-run on that 
build tree.  Similar to
the command:

cmake .

But if you want to do an out of source build and an in source build 
(which if you have any
generated files will most likely cause hard to track down errors)  you 
can do this:

cmake -H/path/to/Source -B/path/to/binary

That removes ambiguity from the command, and cmake will honor it.

-Bill



More information about the CMake mailing list