This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  94fcf65d4e5efc9d77d944cf4c52ff16ebb3bad5 (commit)
       via  f17394185558d6adc4e09c19937c798580fbf1f3 (commit)
      from  98192941e80255650764d30b2da701f9c596890f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94fcf65d4e5efc9d77d944cf4c52ff16ebb3bad5
commit 94fcf65d4e5efc9d77d944cf4c52ff16ebb3bad5
Merge: 9819294 f173941
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Dec 14 09:56:04 2016 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Dec 14 09:56:04 2016 -0500

    Merge topic 'codelite-build-and-clean-targets-enhancement' into next
    
    f1739418 CodeLite: Make build/clean/rebuild operations optionally 
target-centric


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f17394185558d6adc4e09c19937c798580fbf1f3
commit f17394185558d6adc4e09c19937c798580fbf1f3
Author:     Minze Zwerver <ysblo...@gmail.com>
AuthorDate: Tue Dec 13 14:21:22 2016 +0100
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Dec 14 09:55:41 2016 -0500

    CodeLite: Make build/clean/rebuild operations optionally target-centric
    
    When `CMAKE_CODELITE_USE_TARGETS` is enabled, these operations should
    be target-centric too.

diff --git a/Help/release/dev/codelite-build-and-clean-targets-enhancement.rst 
b/Help/release/dev/codelite-build-and-clean-targets-enhancement.rst
new file mode 100644
index 0000000..c6b78cf
--- /dev/null
+++ b/Help/release/dev/codelite-build-and-clean-targets-enhancement.rst
@@ -0,0 +1,10 @@
+codelite-build-and-clean-targets-enhancement
+--------------------------------------------
+
+* The :generator:`CodeLite` extra generator gained a new option
+  set by the :variable:`CMAKE_CODELITE_USE_TARGETS` variable to
+  change the generated project to have target-centric organization.
+  The "build", "rebuild", and "clean" operations within CodeLite
+  then work on a selected target rather than the whole workspace.
+  (Note that the :generator:`Ninja` clean operation on a target
+  includes its dependencies, though.)
diff --git a/Source/cmExtraCodeLiteGenerator.cxx 
b/Source/cmExtraCodeLiteGenerator.cxx
index e79f763..fd7da18 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -129,12 +129,13 @@ std::vector<std::string> 
cmExtraCodeLiteGenerator::CreateProjectsByTarget(
          lt != (*lg)->GetGeneratorTargets().end(); lt++) {
       cmStateEnums::TargetType type = (*lt)->GetType();
       std::string outputDir = (*lg)->GetCurrentBinaryDirectory();
-      std::string filename = outputDir + "/" + (*lt)->GetName() + ".project";
-      retval.push_back((*lt)->GetName());
+      std::string targetName = (*lt)->GetName();
+      std::string filename = outputDir + "/" + targetName + ".project";
+      retval.push_back(targetName);
       // Make the project file relative to the workspace
       std::string relafilename = cmSystemTools::RelativePath(
         this->WorkspacePath.c_str(), filename.c_str());
-      std::string visualname = (*lt)->GetName();
+      std::string visualname = targetName;
       switch (type) {
         case cmStateEnums::SHARED_LIBRARY:
         case cmStateEnums::STATIC_LIBRARY:
@@ -302,7 +303,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
   std::string projectPath = cmSystemTools::GetFilenamePath(filename);
 
   CreateProjectSourceEntries(cFiles, otherFiles, &xml, projectPath, mf,
-                             projectType);
+                             projectType, "");
 
   xml.EndElement(); // CodeLite_Project
 }
@@ -352,7 +353,7 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
   std::map<std::string, cmSourceFile*>& cFiles,
   std::set<std::string>& otherFiles, cmXMLWriter* _xml,
   const std::string& projectPath, const cmMakefile* mf,
-  const std::string& projectType)
+  const std::string& projectType, const std::string& targetName)
 {
 
   cmXMLWriter& xml(*_xml);
@@ -430,8 +431,11 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
 
   xml.StartElement("General");
   std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
+  std::string relapath;
   if (!outputPath.empty()) {
-    xml.Attribute("OutputFile", outputPath + "/$(ProjectName)");
+    relapath = cmSystemTools::RelativePath(this->WorkspacePath.c_str(),
+                                           outputPath.c_str());
+    xml.Attribute("OutputFile", relapath + "/$(ProjectName)");
   } else {
     xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
   }
@@ -439,7 +443,7 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
   xml.Attribute("Command", "./$(ProjectName)");
   xml.Attribute("CommandArguments", "");
   if (!outputPath.empty()) {
-    xml.Attribute("WorkingDirectory", outputPath);
+    xml.Attribute("WorkingDirectory", relapath);
   } else {
     xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
   }
@@ -460,9 +464,9 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries(
 
   xml.StartElement("CustomBuild");
   xml.Attribute("Enabled", "yes");
-  xml.Element("RebuildCommand", GetRebuildCommand(mf));
-  xml.Element("CleanCommand", GetCleanCommand(mf));
-  xml.Element("BuildCommand", GetBuildCommand(mf));
+  xml.Element("RebuildCommand", GetRebuildCommand(mf, targetName));
+  xml.Element("CleanCommand", GetCleanCommand(mf, targetName));
+  xml.Element("BuildCommand", GetBuildCommand(mf, targetName));
   xml.Element("SingleFileCommand", GetSingleFileBuildCommand(mf));
   xml.Element("PreprocessFileCommand");
   xml.Element("WorkingDirectory", "$(WorkspacePath)");
@@ -511,12 +515,13 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
   ////////////////////////////////////
   xml.StartDocument("utf-8");
   xml.StartElement("CodeLite_Project");
-  std::string visualname = gt->GetName();
+  std::string targetName = gt->GetName();
+  std::string visualname = targetName;
   switch (gt->GetType()) {
     case cmStateEnums::STATIC_LIBRARY:
     case cmStateEnums::SHARED_LIBRARY:
     case cmStateEnums::MODULE_LIBRARY:
-      visualname = "lib" + visualname;
+      visualname = "lib" + targetName;
     default: // intended fallthrough
       break;
   }
@@ -541,7 +546,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
   std::string projectPath = cmSystemTools::GetFilenamePath(filename);
 
   CreateProjectSourceEntries(cFiles, otherFiles, &xml, projectPath, mf,
-                             projectType);
+                             projectType, targetName);
 
   xml.EndElement(); // CodeLite_Project
 }
@@ -586,31 +591,43 @@ std::string 
cmExtraCodeLiteGenerator::GetConfigurationName(
 }
 
 std::string cmExtraCodeLiteGenerator::GetBuildCommand(
-  const cmMakefile* mf) const
+  const cmMakefile* mf, const std::string& targetName) const
 {
   std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
   std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
   std::string buildCommand = make; // Default
+  std::ostringstream ss;
   if (generator == "NMake Makefiles" || generator == "Ninja") {
-    buildCommand = make;
+    ss << make;
   } else if (generator == "MinGW Makefiles" || generator == "Unix Makefiles") {
-    std::ostringstream ss;
     ss << make << " -j " << this->CpuCount;
-    buildCommand = ss.str();
   }
+  if (!targetName.empty()) {
+    ss << " " << targetName;
+  }
+  buildCommand = ss.str();
   return buildCommand;
 }
 
 std::string cmExtraCodeLiteGenerator::GetCleanCommand(
-  const cmMakefile* mf) const
+  const cmMakefile* mf, const std::string& targetName) const
 {
-  return GetBuildCommand(mf) + " clean";
+  std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR");
+  std::ostringstream ss;
+  std::string buildcommand = GetBuildCommand(mf, "");
+  if (!targetName.empty() && generator == "Ninja") {
+    ss << buildcommand << " -t clean " << targetName;
+  } else {
+    ss << buildcommand << " clean";
+  }
+  return ss.str();
 }
 
 std::string cmExtraCodeLiteGenerator::GetRebuildCommand(
-  const cmMakefile* mf) const
+  const cmMakefile* mf, const std::string& targetName) const
 {
-  return GetCleanCommand(mf) + " && " + GetBuildCommand(mf);
+  return GetCleanCommand(mf, targetName) + " && " +
+    GetBuildCommand(mf, targetName);
 }
 
 std::string cmExtraCodeLiteGenerator::GetSingleFileBuildCommand(
diff --git a/Source/cmExtraCodeLiteGenerator.h 
b/Source/cmExtraCodeLiteGenerator.h
index a349db5..773515d 100644
--- a/Source/cmExtraCodeLiteGenerator.h
+++ b/Source/cmExtraCodeLiteGenerator.h
@@ -28,9 +28,12 @@ protected:
 protected:
   std::string GetCodeLiteCompilerName(const cmMakefile* mf) const;
   std::string GetConfigurationName(const cmMakefile* mf) const;
-  std::string GetBuildCommand(const cmMakefile* mf) const;
-  std::string GetCleanCommand(const cmMakefile* mf) const;
-  std::string GetRebuildCommand(const cmMakefile* mf) const;
+  std::string GetBuildCommand(const cmMakefile* mf,
+                              const std::string& targetName) const;
+  std::string GetCleanCommand(const cmMakefile* mf,
+                              const std::string& targetName) const;
+  std::string GetRebuildCommand(const cmMakefile* mf,
+                                const std::string& targetName) const;
   std::string GetSingleFileBuildCommand(const cmMakefile* mf) const;
   std::vector<std::string> CreateProjectsByTarget(cmXMLWriter* xml);
   std::vector<std::string> CreateProjectsByProjectMaps(cmXMLWriter* xml);
@@ -45,7 +48,8 @@ protected:
                                   cmXMLWriter* xml,
                                   const std::string& projectPath,
                                   const cmMakefile* mf,
-                                  const std::string& projectType);
+                                  const std::string& projectType,
+                                  const std::string& targetName);
 
 public:
   cmExtraCodeLiteGenerator();

-----------------------------------------------------------------------

Summary of changes:
 ...odelite-build-and-clean-targets-enhancement.rst |   10 ++++
 Source/cmExtraCodeLiteGenerator.cxx                |   59 +++++++++++++-------
 Source/cmExtraCodeLiteGenerator.h                  |   12 ++--
 3 files changed, 56 insertions(+), 25 deletions(-)
 create mode 100644 
Help/release/dev/codelite-build-and-clean-targets-enhancement.rst


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to