[CMake] out of source command line flag
Alexander Neundorf
a.neundorf-work at gmx.net
Sat Sep 5 13:09:18 EDT 2009
On Saturday 05 September 2009, Eric Noulard wrote:
> Continued....
...
> CMake may guess which one is the build tree using this algorithm.
>
> 1) If there is a CMakeCache.txt in the dir then this is a build tree
> 2) If the path does not exists then this is a "to be created" build tree
>
> error cases are:
>
> E1) One gives two existing dir with none containing a CMakeCache.txt
> ==> send an error message explaining that and abort.
>
> E2) One gives two directories
> E21) both contains a CMakeCache.txt
> or E22) one contains a CMakeCache.txt and the other does not exists.
>
> E21 is plain wrong
> E22 the source tree may have been polluted with a previous
> in-source config.
>
> E3) One gives a build tree which does not correspond to the given source
> tree This is easy to check because CMakeCache.txt contains
> <PROJECT>_SOURCE_DIR
>
> If this appear CMake should abort and send a message telling
> the source tree/build tree mismatch.
I think it could be easier than that.
E1) none of the two directories contains a CMakeLists.txt
E2) both directories contain a CMakeLists.txt
In all other case, one directory contains a CMakeLists.txt, this is the source
dir. The other directory does not contain a CMakeLists.txt, so it is not a
source dir. It may contain a CMakeCache.txt, then it is already a build dir.
If it does not, it will become the build dir.
Alex
More information about the CMake
mailing list