From 057633151a527fc614b56f4ca3fd73f63928ebff Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 31 Oct 2011 23:37:01 +0100 Subject: [PATCH 1/2] Eclipse: make targets work from any directory Set the working directory for make targets which are associated to virtual folders, otherwise Eclipse simply runs make from the current working directory (where Eclipse has been started), and where probably not the correct makefile is located. Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 785e85a61..eab149ead 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -998,7 +998,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string virtDir = "[Targets]/"; virtDir += prefix; virtDir += ti->first; - this->AppendTarget(fout, "Build", make, makeArgs, virtDir, "", + std::string buildArgs = "-C "; + buildArgs += makefile->GetHomeOutputDirectory(); + buildArgs += " "; + buildArgs += makeArgs; + this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", ti->first.c_str()); std::string cleanArgs = "-E chdir \""; From d31b1aca3fcf5d8c0e7ab5cbb37045ad87dead79 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Tue, 1 Nov 2011 21:23:52 +0100 Subject: [PATCH 2/2] Eclipse: quote the build dir (to make it work with spaces) When creating the targets for Eclipse, quote the directory in which make should change. Otherwise it will fail if the path contains with spaces. Alex --- Source/cmExtraEclipseCDT4Generator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index eab149ead..a338031d8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -998,9 +998,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string virtDir = "[Targets]/"; virtDir += prefix; virtDir += ti->first; - std::string buildArgs = "-C "; + std::string buildArgs = "-C \""; buildArgs += makefile->GetHomeOutputDirectory(); - buildArgs += " "; + buildArgs += "\" "; buildArgs += makeArgs; this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", ti->first.c_str());