diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index 37b72fa38..ae174544b 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -77,6 +77,8 @@ endif() # This variable is used by the Eclipse generator and appended to the make invocation commands. 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") +set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets") + # This variable is used by the Eclipse generator in out-of-source builds only. set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 96b8a0920..7464657ee 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -38,6 +38,7 @@ cmExtraEclipseCDT4Generator this->SupportedGlobalGenerators.push_back("Unix Makefiles"); this->SupportsVirtualFolders = true; + this->GenerateLinkedResources = true; } //---------------------------------------------------------------------------- @@ -83,6 +84,9 @@ void cmExtraEclipseCDT4Generator::Generate() this->HomeDirectory = mf->GetHomeDirectory(); this->HomeOutputDirectory = mf->GetHomeOutputDirectory(); + this->GenerateLinkedResources = mf->IsOn( + "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES"); + this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory); this->GenerateSourceProject = (this->IsOutOfSourceBuild && @@ -501,6 +505,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( linkName2 += ti->first; this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", VirtualFolder); + if (!this->GenerateLinkedResources) + { + break; // skip generating the linked resources to the source files + } std::vector sourceGroups=makefile->GetSourceGroups(); // get the files from the source lists then add them to the groups cmTarget* tgt = const_cast(&ti->second); @@ -555,6 +563,11 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( cmGeneratedFileStream& fout, const std::string& baseDir) { + if (!this->GenerateLinkedResources) + { + return; + } + // 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]", diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 37ce65e75..31ad68da9 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -109,6 +109,7 @@ private: std::string HomeOutputDirectory; bool IsOutOfSourceBuild; bool GenerateSourceProject; + bool GenerateLinkedResources; bool SupportsVirtualFolders; };