[CMake] out of source command line flag
Eric Noulard
eric.noulard at gmail.com
Sat Sep 5 11:23:15 EDT 2009
2009/9/5 Bill Hoffman <bill.hoffman at kitware.com>:
> Alan W. Irwin wrote:
>>
>> On 2009-09-05 09:38+0200 Hendrik Sattler wrote:
>>
>>> The problem with how giving the build-dir/source-dir to cmake is
>>> currently too
>>> much dependent on other conditions:
>>> cmake [options] <path-to-source>
>>> cmake [options] <path-to-existing-build>
>>>
>>> The first only is true if no CMakeCache.txt exists there. This was
>>> actually a
>>> bad choice to have that as only possibility.
>>> Being able to do an out-of-source build even if there was a previous
>>> in-source
>>> build would be much appreciated.
>>
>> I second that motion to drop the <path-to-existing-build> interpretation
>> (subject to policy protection, of course, assuming there is at least some
>> legitimate use case for <patch-to-existing-build>.)
>>
>> CMake newbie's natural tendency seems to be to try an in-source build
>> first.
>> Thus, I cannot count how many times PLplot and FreeEOS users out-of-source
>> build experience has been silently messed up by their first build attempt
>> which was in source.
It would be at least interesting to be able to programmatically
check (from within CMakeLists.txt)
that user does in-source build in order to be able to MESSAGE
a warning for dubious usage, i.e.
1) "Look like an attempt to do out-of-source but your
build will be in-source because of an existing CMakeCache.txt"
CMake may setup a CMAKE_BUILDING_INSOURCE
when CMakeCache.txt is inside CMAKE_SOURCE_DIR
or Working Dir == CMAKE_SOURCE_DIR
Thus if
Working Dir != CMAKE_SOURCE_DIR
AND
CMAKE_BUILDING_INSOURCE
Then the user may not be doing what he wants.
2) In the same way I did file a
>> I have never heard of users actually using the
>> <path-to-existing-build> interpretation except by mistake. However,
>> assuming there is some legitimate use case, I suggest you make a POLICY to
>> drop the <path-to-existing-build> interpretation. I would be happy to
>> adopt
>> such a policy for my different software projects simply to drop the volume
>> of necessary advice to first-time users who keep falling into the trap of
>> using <path-to-existing-build> by mistake.
>>
> I use this all the time, and so do lots of people that I know. They do this:
>
> cmake .
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list