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

Eric Noulard eric.noulard at gmail.com
Tue Nov 1 06:29:55 EDT 2011


2011/11/1 Alexander Neundorf <neundorf at kde.org>:
> 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.

or may be use:
ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE
option, and import the two projects?

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

I think a warning is enough, moreover where are we with the
version control integration issue?
http://www.vtk.org/Wiki/Eclipse_CDT4_Generator#Discussion_about_limitations

I just checked that linked resource for the source does not show
version control.
I speak about that issue [again] because when I use eclipse+cmake I usually
do it by hand with a build dir as a subdir of source dir i.e.
source/build
and with hand-crafted
source/.project
source/.cproject
that way I get the source control working as expected and all the file
for the concerned project are in a single dir.

So before making the build dir as a source subdir case FATAL, are you sure
we really don't want to authorize the generatiion of .project
.cproject in the source dir
in this very particular but nervertheless very useful case?

I know that we should never generate files in the source dir, but
after 3+ years it seems
that eclipse is not able (correct me if I'm wrong) to enable source
control on "part"
of the project.


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


More information about the CMake mailing list