[CMake] out of source command line flag

Eric Noulard eric.noulard at gmail.com
Sat Sep 5 13:24:19 EDT 2009


2009/9/5 Alexander Neundorf <a.neundorf-work at gmx.net>:
> On Saturday 05 September 2009, Eric Noulard wrote:
[...]

>> 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.

Fair enough,
my tortuous mind was tracking the build tree yours
is tracking the source tree, this is obviously a
better choice.

My E3) case still remains, you really  don't want to mess-up
an existing build tree with a unrelated source tree.

I know however that my proposal does not solve the other problem
regarding ignoring "<path-to-existing-build>" raised in this thread.

Moreover the problem raised by Alan:

"If you would prefer not to have policy about this issue, is there some
technical means of detecting when the cmake invocation directory is not the
same as the build directory?  The combination of cmake invocation directory
!= build directory AND build_directory == source directory is the one I want
to avoid (by erroring out with appropriate message) since that is the
combination that appears to get newbies into trouble."

is important to me too.

In the current one arg cmake invocation we should have a way to
detect/avoid an unvoluntary in-source build.
Currently we cannot.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list