summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-12-19 15:12:49 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-12-19 15:12:49 (GMT)
commit33498bba9cb7e868429b4a72e9e9f60aba21d387 (patch)
tree1f1949894e1801585d2e6d75ff2718b6302aae62 /Source
parenta1e58db6757f49d727831852cd8421c64d69ddf5 (diff)
parentc3d20c2ac940721035b1ad0a43cfc160205d1cde (diff)
downloadCMake-33498bba9cb7e868429b4a72e9e9f60aba21d387.zip
CMake-33498bba9cb7e868429b4a72e9e9f60aba21d387.tar.gz
CMake-33498bba9cb7e868429b4a72e9e9f60aba21d387.tar.bz2
Merge topic 'KateFixNinja'
c3d20c2 kate: fix ninja support 1eaf2f2 kate: remove unused function
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExtraKateGenerator.cxx75
-rw-r--r--Source/cmExtraKateGenerator.h6
2 files changed, 24 insertions, 57 deletions
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index f020ddb..177ef8d 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -52,6 +52,8 @@ void cmExtraKateGenerator::Generate()
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(mf->GetHomeOutputDirectory()));
+ this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0);
+
this->CreateKateProjectFile(mf);
this->CreateDummyKateProjectFile(mf);
}
@@ -95,11 +97,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_KATE_MAKE_ARGUMENTS");
+ const char* homeOutputDir = mf->GetHomeOutputDirectory();
this->AppendTarget(fout, "all", make, makeArgs,
- mf->GetHomeOutputDirectory());
+ homeOutputDir, homeOutputDir);
this->AppendTarget(fout, "clean", make, makeArgs,
- mf->GetHomeOutputDirectory());
+ homeOutputDir, homeOutputDir);
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
@@ -143,7 +146,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
}
if (insertTarget)
{
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
}
}
break;
@@ -158,7 +162,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
break;
}
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
break;
case cmTarget::EXECUTABLE:
case cmTarget::STATIC_LIBRARY:
@@ -166,10 +171,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
case cmTarget::MODULE_LIBRARY:
case cmTarget::OBJECT_LIBRARY:
{
- this->AppendTarget(fout, ti->first, make, makeArgs, currentDir);
+ this->AppendTarget(fout, ti->first, make, makeArgs,
+ currentDir, homeOutputDir);
std::string fastTarget = ti->first;
fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget, make, makeArgs, currentDir);
+ this->AppendTarget(fout, fastTarget, make, makeArgs,
+ currentDir, homeOutputDir);
}
break;
@@ -185,7 +192,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
fit != objectFileTargets.end();
++fit)
{
- this->AppendTarget(fout, *fit, make, makeArgs, currentDir);
+ this->AppendTarget(fout, *fit, make, makeArgs, currentDir,homeOutputDir);
}
}
@@ -199,14 +206,18 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
const std::string& makeArgs,
- const std::string& path) const
+ const std::string& path,
+ const char* homeOutputDir
+ ) const
{
static char JsonSep = ' ';
fout <<
"\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", "
- "\"build_cmd\":\"" << make << " -C " << path << " " << makeArgs << " "
- << target << "\"}\n";
+ "\"build_cmd\":\"" << make
+ << " -C " << (this->UseNinja ? homeOutputDir : path.c_str())
+ << " " << makeArgs << " "
+ << target << "\"}\n";
JsonSep = ',';
}
@@ -326,47 +337,3 @@ std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const
return outputBasename;
}
-
-
-// Create the command line for building the given target using the selected
-// make
-std::string cmExtraKateGenerator::BuildMakeCommand(const std::string& make,
- const char* makefile, const char* target) const
-{
- std::string command = make;
- if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0)
- {
- std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
- command += " /NOLOGO /f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
- {
- // no escaping of spaces in this case, see
- // http://public.kitware.com/Bug/view.php?id=10014
- std::string makefileName = makefile;
- command += " -f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
- {
- command += " -v ";
- command += target;
- }
- else
- {
- std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
- command += " -f &quot;";
- command += makefileName;
- command += "&quot; ";
- command += " VERBOSE=1 ";
- command += target;
- }
- return command;
-}
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index 4979eff..6ced5fe 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -46,17 +46,17 @@ private:
const std::string& target,
const std::string& make,
const std::string& makeArgs,
- const std::string& path) const;
+ const std::string& path,
+ const char* homeOutputDir) const;
std::string GenerateFilesString(const cmMakefile* mf) const;
std::string GetPathBasename(const std::string& path) const;
std::string GenerateProjectName(const std::string& name,
const std::string& type,
const std::string& path) const;
- std::string BuildMakeCommand(const std::string& make,
- const char* makefile, const char* target) const;
std::string ProjectName;
+ bool UseNinja;
};
#endif