[cmake-developers] To warn or to error out ? - wording and compatiblity

David Cole david.cole at kitware.com
Tue Nov 1 10:16:53 EDT 2011


On Tue, Nov 1, 2011 at 5:58 AM, Alexander Neundorf <neundorf at kde.org> wrote:
> Hi,
>
> when using out-of-source builds and the Eclipse CDT project generator, a
> "linked resource" is created in the Eclipse project file, which points to
> CMAKE_SOURCE_DIR, so the user can browse the source directory.
>
> Now, when CMAKE_BINARY_DIR is a subdirectory of CMAKE_SOURCE_DIR (e.g.
> MyProject/build/ ), such a "linked resource" can't be created, and the
> resulting project file still works, but is less usable.
>
> I just added a warning, so that cmake now says:
>
> "-- Configuring done
> CMake Warning in CMakeLists.txt:
>  The build directory is a subdirectory of the source directory.
>
>  This is not supported well by Eclipse.  It is strongly recommended to use a
>  build directory which is not a subdirectory of the source directory.
>
>
> -- Generating done"
>
>
> I'm thinking about using FATAL_ERROR instead of warning for this, since the
> resulting project file without that link really feels wrong, and I recommend
> everybody to not build in a subdir of the source dir.
>
> This would have the effect that a build dir which was working until now does
> not work anymore with the next cmake release, the user would have to create a
> new build dir in some other location.
>
> Would this be acceptable ?
>
> Alex
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>


I think a warning is good enough here.

I would phrase it in the positive sense, rather than in the negative
sense, though:

Rather than:

>  The build directory is a subdirectory of the source directory.
>
>  This is not supported well by Eclipse.  It is strongly recommended to use a
>  build directory which is not a subdirectory of the source directory.

How about "It is strongly recommended to use a build directory which
is a sibling of the source directory."



More information about the cmake-developers mailing list