From b6d4de7911c5d54c087d5616660ee7e4050da834 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Wed, 19 Oct 2011 22:02:14 +0200 Subject: Eclipse: add virtual folder for each target For each target a virtual folder is created, which contains one virtual folder for each sourcegroup, which contain links to the actual source files (#12294, #12223) Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 103 ++++++++++++++++++++++++++++++--- Source/cmExtraEclipseCDT4Generator.h | 4 +- 2 files changed, 99 insertions(+), 8 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index f303f16..3f63646 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmGeneratedFileStream.h" #include "cmTarget.h" +#include "cmSourceFile.h" #include "cmSystemTools.h" #include @@ -414,7 +415,8 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() linkSourceDirectory.c_str())) { this->AppendLinkedResource(fout, sourceLinkedResourceName, - this->GetEclipsePath(linkSourceDirectory)); + this->GetEclipsePath(linkSourceDirectory), + LinkToFolder); this->SrcLinkedResources.push_back(sourceLinkedResourceName); } @@ -425,7 +427,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() // for each sub project create a linked resource to the source dir // - only if it is an out-of-source build this->AppendLinkedResource(fout, "[Subprojects]", - "virtual:/virtual", true); + "virtual:/virtual", VirtualFolder); for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); @@ -443,10 +445,92 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string linkName = "[Subprojects]/"; linkName += it->first; this->AppendLinkedResource(fout, linkName, - this->GetEclipsePath(linkSourceDirectory)); + this->GetEclipsePath(linkSourceDirectory), + LinkToFolder + ); this->SrcLinkedResources.push_back(it->first); } } + + std::string linkName = "[Targets]"; + this->AppendLinkedResource(fout, linkName, "virtual:/virtual", + VirtualFolder); + + + for (std::vector::const_iterator + lgIt = this->GlobalGenerator->GetLocalGenerators().begin(); + lgIt != this->GlobalGenerator->GetLocalGenerators().end(); + ++lgIt) + { + cmMakefile* makefile = (*lgIt)->GetMakefile(); + const cmTargets& targets = makefile->GetTargets(); + + for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti) + { + std::string linkName2 = linkName; + linkName2 += "/"; + switch(ti->second.GetType()) + { + case cmTarget::EXECUTABLE: + case cmTarget::STATIC_LIBRARY: + case cmTarget::SHARED_LIBRARY: + case cmTarget::MODULE_LIBRARY: + { + const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ? + "[exe] " : "[lib] "); + linkName2 += prefix; + linkName2 += ti->first; + this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", + VirtualFolder); + std::vector sourceGroups = + makefile->GetSourceGroups(); + // get the files from the source lists then add them to the groups + cmTarget* tgt = const_cast(&ti->second); + std::vectorconst & files = tgt->GetSourceFiles(); + for(std::vector::const_iterator sfIt = files.begin(); + sfIt != files.end(); + sfIt++) + { + // Add the file to the list of sources. + std::string source = (*sfIt)->GetFullPath(); + cmSourceGroup& sourceGroup = + makefile->FindSourceGroup(source.c_str(), sourceGroups); + sourceGroup.AssignSource(*sfIt); + } + + + for(std::vector::iterator sgIt=sourceGroups.begin(); + sgIt != sourceGroups.end(); + ++sgIt) + { + std::string linkName3 = linkName2; + linkName3 += "/"; + linkName3 += sgIt->GetFullName(); + this->AppendLinkedResource(fout, linkName3, "virtual:/virtual", + VirtualFolder); + + std::vector sFiles = sgIt->GetSourceFiles(); + for(std::vector::const_iterator fileIt = + sFiles.begin(); + fileIt != sFiles.end(); + ++fileIt) + { + std::string linkName4 = linkName3; + linkName4 += "/"; + linkName4 += + cmSystemTools::GetFilenameName((*fileIt)->GetFullPath()); + this->AppendLinkedResource(fout, linkName4, + (*fileIt)->GetFullPath(), LinkToFile); + } + } + } + break; + // ignore all others: + default: + break; + } + } + } } // I'm not sure this makes too much sense. There can be different @@ -1115,20 +1199,25 @@ void cmExtraEclipseCDT4Generator ::AppendLinkedResource (cmGeneratedFileStream& fout, const std::string& name, const std::string& path, - bool isVirtualFolder) + LinkType linkType) { const char* locationTag = "location"; - if (isVirtualFolder) // ... and not a linked folder + const char* typeTag = "2"; + if (linkType == VirtualFolder) // ... and not a linked folder { locationTag = "locationURI"; } + if (linkType == LinkToFile) + { + typeTag = "1"; + } fout << "\t\t\n" "\t\t\t" << cmExtraEclipseCDT4Generator::EscapeForXML(name) << "\n" - "\t\t\t2\n" + "\t\t\t" << typeTag << "\n" "\t\t\t<" << locationTag << ">" << cmExtraEclipseCDT4Generator::EscapeForXML(path) << "\n" @@ -1177,7 +1266,7 @@ bool cmExtraEclipseCDT4Generator else { this->AppendLinkedResource(fout, name, - this->GetEclipsePath(outputPath)); + this->GetEclipsePath(outputPath), LinkToFolder); this->OutLinkedResources.push_back(name); return true; } diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index b866619..2c7aa43 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -25,6 +25,8 @@ class cmGeneratedFileStream; class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator { public: + enum LinkType {VirtualFolder, LinkToFolder, LinkToFile }; + cmExtraEclipseCDT4Generator(); static cmExternalMakefileProjectGenerator* New() { @@ -88,7 +90,7 @@ private: static void AppendLinkedResource (cmGeneratedFileStream& fout, const std::string& name, const std::string& path, - bool isVirtualFolder = false); + LinkType linkType); bool AppendOutLinkedResource(cmGeneratedFileStream& fout, const std::string& defname, -- cgit v0.12 From cef6bd94d76a24c5948fea0224a78217f34c0b23 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 23 Oct 2011 11:00:45 +0200 Subject: Eclipse: move code for generating links to projects into separate function Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 63 +++++++++++++++++++--------------- Source/cmExtraEclipseCDT4Generator.h | 3 ++ 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 3f63646..c1a810b 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -424,33 +424,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() if (this->SupportsVirtualFolders) { - // for each sub project create a linked resource to the source dir - // - only if it is an out-of-source build - this->AppendLinkedResource(fout, "[Subprojects]", - "virtual:/virtual", VirtualFolder); - - for (std::map >::const_iterator - it = this->GlobalGenerator->GetProjectMap().begin(); - it != this->GlobalGenerator->GetProjectMap().end(); - ++it) - { - std::string linkSourceDirectory = this->GetEclipsePath( - it->second[0]->GetMakefile()->GetStartDirectory()); - // a linked resource must not point to a parent directory of .project or - // .project itself - if ((this->HomeOutputDirectory != linkSourceDirectory) && - !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), - linkSourceDirectory.c_str())) - { - std::string linkName = "[Subprojects]/"; - linkName += it->first; - this->AppendLinkedResource(fout, linkName, - this->GetEclipsePath(linkSourceDirectory), - LinkToFolder - ); - this->SrcLinkedResources.push_back(it->first); - } - } + this->CreateLinksToSubprojects(fout); std::string linkName = "[Targets]"; this->AppendLinkedResource(fout, linkName, "virtual:/virtual", @@ -550,6 +524,41 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() fout << "\n"; } + +//---------------------------------------------------------------------------- +void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( + cmGeneratedFileStream& fout) +{ + // for each sub project create a linked resource to the source dir + // - only if it is an out-of-source build + this->AppendLinkedResource(fout, "[Subprojects]", + "virtual:/virtual", VirtualFolder); + + for (std::map >::const_iterator + it = this->GlobalGenerator->GetProjectMap().begin(); + it != this->GlobalGenerator->GetProjectMap().end(); + ++it) + { + std::string linkSourceDirectory = this->GetEclipsePath( + it->second[0]->GetMakefile()->GetStartDirectory()); + // a linked resource must not point to a parent directory of .project or + // .project itself + if ((this->HomeOutputDirectory != linkSourceDirectory) && + !cmSystemTools::IsSubDirectory(this->HomeOutputDirectory.c_str(), + linkSourceDirectory.c_str())) + { + std::string linkName = "[Subprojects]/"; + linkName += it->first; + this->AppendLinkedResource(fout, linkName, + this->GetEclipsePath(linkSourceDirectory), + LinkToFolder + ); + this->SrcLinkedResources.push_back(it->first); + } + } +} + + //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( cmGeneratedFileStream& fout, diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 2c7aa43..5a1a453 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -103,6 +103,9 @@ private: static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar, cmMakefile* mf); + void CreateLinksToSubprojects(cmGeneratedFileStream& fout); + + std::vector SrcLinkedResources; std::vector OutLinkedResources; std::string HomeDirectory; -- cgit v0.12 From c3f30bdd63682b4ba7166e23b3b3dc38548aab07 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 23 Oct 2011 12:22:20 +0200 Subject: Eclipse: move code for generating links to targets into separate function Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 162 +++++++++++++++++---------------- Source/cmExtraEclipseCDT4Generator.h | 2 +- 2 files changed, 84 insertions(+), 80 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index c1a810b..9fc9e16 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -426,85 +426,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() { this->CreateLinksToSubprojects(fout); - std::string linkName = "[Targets]"; - this->AppendLinkedResource(fout, linkName, "virtual:/virtual", - VirtualFolder); - - - for (std::vector::const_iterator - lgIt = this->GlobalGenerator->GetLocalGenerators().begin(); - lgIt != this->GlobalGenerator->GetLocalGenerators().end(); - ++lgIt) - { - cmMakefile* makefile = (*lgIt)->GetMakefile(); - const cmTargets& targets = makefile->GetTargets(); - - for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti) - { - std::string linkName2 = linkName; - linkName2 += "/"; - switch(ti->second.GetType()) - { - case cmTarget::EXECUTABLE: - case cmTarget::STATIC_LIBRARY: - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: - { - const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ? - "[exe] " : "[lib] "); - linkName2 += prefix; - linkName2 += ti->first; - this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", - VirtualFolder); - std::vector sourceGroups = - makefile->GetSourceGroups(); - // get the files from the source lists then add them to the groups - cmTarget* tgt = const_cast(&ti->second); - std::vectorconst & files = tgt->GetSourceFiles(); - for(std::vector::const_iterator sfIt = files.begin(); - sfIt != files.end(); - sfIt++) - { - // Add the file to the list of sources. - std::string source = (*sfIt)->GetFullPath(); - cmSourceGroup& sourceGroup = - makefile->FindSourceGroup(source.c_str(), sourceGroups); - sourceGroup.AssignSource(*sfIt); - } - - - for(std::vector::iterator sgIt=sourceGroups.begin(); - sgIt != sourceGroups.end(); - ++sgIt) - { - std::string linkName3 = linkName2; - linkName3 += "/"; - linkName3 += sgIt->GetFullName(); - this->AppendLinkedResource(fout, linkName3, "virtual:/virtual", - VirtualFolder); - - std::vector sFiles = sgIt->GetSourceFiles(); - for(std::vector::const_iterator fileIt = - sFiles.begin(); - fileIt != sFiles.end(); - ++fileIt) - { - std::string linkName4 = linkName3; - linkName4 += "/"; - linkName4 += - cmSystemTools::GetFilenameName((*fileIt)->GetFullPath()); - this->AppendLinkedResource(fout, linkName4, - (*fileIt)->GetFullPath(), LinkToFile); - } - } - } - break; - // ignore all others: - default: - break; - } - } - } + this->CreateLinksForTargets(fout); } // I'm not sure this makes too much sense. There can be different @@ -526,6 +448,88 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() //---------------------------------------------------------------------------- +void cmExtraEclipseCDT4Generator::CreateLinksForTargets( + cmGeneratedFileStream& fout) +{ + std::string linkName = "[Targets]"; + this->AppendLinkedResource(fout, linkName, "virtual:/virtual",VirtualFolder); + + for (std::vector::const_iterator + lgIt = this->GlobalGenerator->GetLocalGenerators().begin(); + lgIt != this->GlobalGenerator->GetLocalGenerators().end(); + ++lgIt) + { + cmMakefile* makefile = (*lgIt)->GetMakefile(); + const cmTargets& targets = makefile->GetTargets(); + + for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti) + { + std::string linkName2 = linkName; + linkName2 += "/"; + switch(ti->second.GetType()) + { + case cmTarget::EXECUTABLE: + case cmTarget::STATIC_LIBRARY: + case cmTarget::SHARED_LIBRARY: + case cmTarget::MODULE_LIBRARY: + { + const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ? + "[exe] " : "[lib] "); + linkName2 += prefix; + linkName2 += ti->first; + this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", + VirtualFolder); + std::vector sourceGroups=makefile->GetSourceGroups(); + // get the files from the source lists then add them to the groups + cmTarget* tgt = const_cast(&ti->second); + std::vectorconst & files = tgt->GetSourceFiles(); + for(std::vector::const_iterator sfIt = files.begin(); + sfIt != files.end(); + sfIt++) + { + // Add the file to the list of sources. + std::string source = (*sfIt)->GetFullPath(); + cmSourceGroup& sourceGroup = + makefile->FindSourceGroup(source.c_str(), sourceGroups); + sourceGroup.AssignSource(*sfIt); + } + + for(std::vector::iterator sgIt = sourceGroups.begin(); + sgIt != sourceGroups.end(); + ++sgIt) + { + std::string linkName3 = linkName2; + linkName3 += "/"; + linkName3 += sgIt->GetFullName(); + this->AppendLinkedResource(fout, linkName3, "virtual:/virtual", + VirtualFolder); + + std::vector sFiles = sgIt->GetSourceFiles(); + for(std::vector::const_iterator fileIt = + sFiles.begin(); + fileIt != sFiles.end(); + ++fileIt) + { + std::string linkName4 = linkName3; + linkName4 += "/"; + linkName4 += + cmSystemTools::GetFilenameName((*fileIt)->GetFullPath()); + this->AppendLinkedResource(fout, linkName4, + (*fileIt)->GetFullPath(), LinkToFile); + } + } + } + break; + // ignore all others: + default: + break; + } + } + } +} + + +//---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( cmGeneratedFileStream& fout) { diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 5a1a453..ac2de16 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -104,7 +104,7 @@ private: cmMakefile* mf); void CreateLinksToSubprojects(cmGeneratedFileStream& fout); - + void CreateLinksForTargets(cmGeneratedFileStream& fout); std::vector SrcLinkedResources; std::vector OutLinkedResources; -- cgit v0.12 From 117f2b8257d92328b32cb90ced3d85d88815130b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 23 Oct 2011 12:25:33 +0200 Subject: Eclipse: add Build and Clean targets to targets With this commit the virtual folder for the targets now have "Build" and "Clean" targets associated to them, so you can build and clean per-target now in the project explorer. Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 33 +++++++++++++++++++++++++++++++-- Source/cmExtraEclipseCDT4Generator.h | 3 ++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 9fc9e16..a847666 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -888,6 +888,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string makeArgs = mf->GetSafeDefinition( "CMAKE_ECLIPSE_MAKE_ARGUMENTS"); + const std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND"); + cmGlobalGenerator* generator = const_cast(this->GlobalGenerator); @@ -976,6 +978,25 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string fastTarget = ti->first; fastTarget += "/fast"; this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix); + + // Add Build and Clean targets in the virtual folder of targets: + if (this->SupportsVirtualFolders) + { + std::string virtDir = "[Targets]/"; + virtDir += prefix; + virtDir += ti->first; + this->AppendTarget(fout, "Build", make, makeArgs, virtDir, "", + ti->first.c_str()); + + std::string cleanArgs = "-E chdir \""; + cleanArgs += makefile->GetCurrentOutputDirectory(); + cleanArgs += "\" \""; + cleanArgs += cmake; + cleanArgs += "\" -P \""; + cleanArgs += (*it)->GetTargetDirectory(ti->second); + cleanArgs += "/cmake_clean.cmake\""; + this->AppendTarget(fout, "Clean", cmake, cleanArgs, virtDir, "", ""); + } } break; // ignore these: @@ -1160,9 +1181,17 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout, const std::string& make, const std::string& makeArgs, const std::string& path, - const char* prefix) + const char* prefix, + const char* makeTarget + ) { std::string targetXml = cmExtraEclipseCDT4Generator::EscapeForXML(target); + std::string makeTargetXml = targetXml; + if (makeTarget != NULL) + { + makeTargetXml = cmExtraEclipseCDT4Generator::EscapeForXML(makeTarget); + } + cmExtraEclipseCDT4Generator::EscapeForXML(target); std::string pathXml = cmExtraEclipseCDT4Generator::EscapeForXML(path); fout << "\n" "" << makeArgs << "\n" - "" << targetXml << "\n" + "" << makeTargetXml << "\n" "true\n" "false\n" "\n" diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index ac2de16..61302e7 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -75,7 +75,8 @@ private: const std::string& make, const std::string& makeArguments, const std::string& path, - const char* prefix = ""); + const char* prefix = "", + const char* makeTarget = NULL); static void AppendScannerProfile (cmGeneratedFileStream& fout, const std::string& profileID, bool openActionEnabled, -- cgit v0.12 From 70de8bd5ae95936b8187e1af707e2d0111c74329 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 23 Oct 2011 14:33:25 +0200 Subject: Eclipse: detect number of CPUs, set CMAKE_ECLIPSE_MAKE_ARGUMENTS accordigly Using the new module ProcessorCount.cmake now the number of CPUs is detected, and if it is bigger than 1, make -jX is set accordingly. Alex --- Modules/CMakeFindEclipseCDT4.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index cf0984e..f7a6e29 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -54,8 +54,20 @@ ENDFUNCTION() _FIND_ECLIPSE_VERSION() +# Try to find out how many CPUs we have and set the -j argument for make accordingly +SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "") + +INCLUDE(ProcessorCount) +PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT) + +# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name +# (we may also get here in the future e.g. for ninja) +IF("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make) + SET(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}") +ENDIF() + # This variable is used by the Eclipse generator and appended to the make invocation commands. -SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") +SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") # This variable is used by the Eclipse generator in out-of-source builds only. SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") -- cgit v0.12 From 66bd543b9b0b09d38697f2c321dda7e4aeb6916d Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 23 Oct 2011 14:58:52 +0200 Subject: Eclipse: fix #12417, don't create wrong src pathentries Actually the Eclipse generator now does not create any CDT_SOURCE pathentries anymore, since I was not able to find out what they are good for, not even by asking on the cdt-dev mailing list. So, at least the warning from eclipse about bad pathentries are gone this way, and I didn't see anything which was not working anymore. Let's see whether we can find out what they are good for. Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a847666..785e85a 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -695,6 +695,18 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const // - make it type 'src' // - and exclude it from type 'out' std::string excludeFromOut; +/* I don't know what the pathentry kind="src" are good for, e.g. autocompletion + * works also without them. Done wrong, the indexer complains, see #12417 + * and #12213. + * The CDT documentation is very terse on that: + * "CDT_SOURCE: Entry kind constant describing a path entry identifying a + * folder containing source code to be compiled." + * Also on the cdt-dev list didn't bring any information: + * http://web.archiveorange.com/archive/v/B4NlJDNIpYoOS1SbxFNy + * So I'm disabling them for now, hoping that somebody will report if something + * is not workging anymore. + * Alex */ +#ifdef DO_CREATE_SRC_PATH_ENTRIES for (std::vector::const_iterator it = this->SrcLinkedResources.begin(); it != this->SrcLinkedResources.end(); @@ -711,6 +723,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const excludeFromOut += this->EscapeForXML(*it) + "/|"; } } +#endif excludeFromOut += "**/CMakeFiles/"; fout << "\n"; -- cgit v0.12