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

Alexander Neundorf neundorf at kde.org
Tue Nov 1 05:58:45 EDT 2011


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



More information about the cmake-developers mailing list