Eclipse: warn if CMAKE_BINARY_DIR is subdir of CMAKE_SOURCE_DIR

Eclipse doesn't handle this case well. When doing out-of-source builds
we create a linked resource which points to CMAKE_SOURCE_DIR, so the
user can browse the source dir in Eclipse. This is not possible
when the build dir is a subdir of the source dir.

Alex
This commit is contained in:
Alex Neundorf 2011-11-01 10:41:23 +01:00
parent 07e88ae449
commit 4b930220be
1 changed files with 10 additions and 0 deletions

View File

@ -87,6 +87,16 @@ void cmExtraEclipseCDT4Generator::Generate()
this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"));
if (cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(),
this->HomeDirectory.c_str()))
{
mf->IssueMessage(cmake::WARNING, "The build directory is a subdirectory "
"of the source directory.\n"
"This is not supported well by Eclipse. It is strongly "
"recommended to use a build directory which is a "
"sibling of the source directory.");
}
// NOTE: This is not good, since it pollutes the source tree. However,
// Eclipse doesn't allow CVS/SVN to work when the .project is not in
// the cvs/svn root directory. Hence, this is provided as an option.