[Cmake-commits] CMake branch, next, updated. v2.8.7-2740-g87823e3

Peter Collingbourne peter at pcc.me.uk
Sun Feb 19 21:11:58 EST 2012


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  87823e331f54ea5e104bf3a7e57cf9240a1ce8a4 (commit)
       via  4d2497419770ad48d9782683a1be9d9cc6966dda (commit)
       via  597ba1ba018a05877360c42dd1efd8afdaf23a20 (commit)
       via  634b293abc8b22df8585b462fdbf2d19e94f3ea7 (commit)
       via  aa0cfca8855cac8c8cca46da222b2faeaf1c5bef (commit)
       via  01a5253316c7c7182323d4797fa13abcc03f093b (commit)
       via  ad1ebd61210fbeca6aef2ca530c74b5279907e17 (commit)
       via  655d5c534b86dd51e2ebf5339201605cbcb88f53 (commit)
       via  ed39b1624f252347199811b9b74323dd7e9d3c0c (commit)
       via  5405a8f42986010fd7cff1cf2140c83777c4c724 (commit)
       via  50583a17c02d18e402c73f92e761f7ddfe623270 (commit)
       via  192849a496f3ddd765f5fec3d55dc4ccbef535de (commit)
       via  e7e53d28c7211ac052e276238eeb25a6025dadf0 (commit)
       via  574112221edc2e2437ea766cdb2cb6263cb832a4 (commit)
      from  d95734ca0fb78236ba2e7431d6afb4cb68c3f776 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87823e331f54ea5e104bf3a7e57cf9240a1ce8a4
commit 87823e331f54ea5e104bf3a7e57cf9240a1ce8a4
Merge: d95734c 4d24974
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 21:11:39 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Feb 19 21:11:39 2012 -0500

    Merge topic 'ninja-generator' into next
    
    4d24974 Import library support for Windows
    597ba1b mark the Windows specific hacks with a comment only
    634b293 disable unfinished Windows ninja support
    aa0cfca add some hacks for Windows
    01a5253 also build ninja support on Windows
    ad1ebd6 Shell encode the command used in custom commands
    655d5c5 Shell encode various CMake invocations
    ed39b16 Shell encode paths used in "cd" commands
    5405a8f Backslash rules for Windows
    50583a1 Identifier encoding rules for ' ' and ':'
    192849a Partially revert "win fixes: escape back slash/colon, use cd. as cmd.exe nop"
    e7e53d2 don't define MSVC_IDE when using the ninja generator
    5741122 win fixes: escape back slash/colon, use cd. as cmd.exe nop


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d2497419770ad48d9782683a1be9d9cc6966dda
commit 4d2497419770ad48d9782683a1be9d9cc6966dda
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 21:38:10 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Feb 19 23:20:03 2012 +0000

    Import library support for Windows

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 687dbb8..ea03cbb 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -31,6 +31,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator()
 #ifdef _WIN32
   this->WindowsShell = true;
 #endif
+  this->TargetImplib = "$TARGET_IMPLIB";
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 66714e9..9294a01 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -172,10 +172,6 @@ cmNinjaNormalTargetGenerator
         i != linkCmds.end();
         ++i)
       {
-#ifdef _WIN32
-       // TODO TARGET_IMPLIB is empty
-       cmSystemTools::ReplaceString(*i, "/implib:", "");
-#endif
       this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
       }
     linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
@@ -314,6 +310,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     this->GetTarget()->GetFullPath(this->GetConfigName(),
                                    /*implib=*/false,
                                    /*realpath=*/true).c_str());
+  std::string targetOutputImplib = ConvertToNinjaPath(
+    this->GetTarget()->GetFullPath(this->GetConfigName(),
+                                   /*implib=*/true).c_str());
 
   // Compute the comment.
   std::ostringstream comment;
@@ -357,6 +356,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     }
   }
 
+  if (!this->TargetNameImport.empty()) {
+    vars["TARGET_IMPLIB"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+      targetOutputImplib.c_str(), cmLocalGenerator::SHELL);
+  }
+
   std::vector<cmCustomCommand> *cmdLists[3] = {
     &this->GetTarget()->GetPreBuildCommands(),
     &this->GetTarget()->GetPreLinkCommands(),
@@ -434,6 +438,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     }
   }
 
+  if (!this->TargetNameImport.empty()) {
+    // Since using multiple outputs would mess up the $out variable, use an
+    // alias for the import library.
+    cmGlobalNinjaGenerator::WritePhonyBuild(this->GetBuildFileStream(),
+                                            "Alias for import library.",
+                                            cmNinjaDeps(1, targetOutputImplib),
+                                            cmNinjaDeps(1, targetOutputReal));
+  }
+
   // Add aliases for the file name and the target name.
   this->GetGlobalGenerator()->AddTargetAlias(this->TargetNameOut,
                                              this->GetTarget());
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1a8d13d..8a563b6 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -223,22 +223,9 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
   if(!cli)
     return cmNinjaDeps();
 
-
-#ifndef _WIN32
   const std::vector<std::string> &deps = cli->GetDepends();
   cmNinjaDeps result(deps.size());
   std::transform(deps.begin(), deps.end(), result.begin(), MapToNinjaPath());
-#else
-  // TODO The ninja generator misses a lot on Windows.
-  //      This hack avoids a problem when a Dll is build:
-  //      It builds the .dll but uses the .lib which is then unknown to ninja.
-  cmNinjaDeps result;
-  for(unsigned i = 0; i < cli->GetItems().size(); ++i) {
-    if( cli->GetItems()[i].Target ) {
-      result.push_back( cli->GetItems()[i].Target->GetName() );
-    }
-  }
-#endif
   return result;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=597ba1ba018a05877360c42dd1efd8afdaf23a20
commit 597ba1ba018a05877360c42dd1efd8afdaf23a20
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Feb 19 19:21:05 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sun Feb 19 19:21:05 2012 +0100

    mark the Windows specific hacks with a comment only

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 97b46bf..66714e9 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -172,7 +172,8 @@ cmNinjaNormalTargetGenerator
         i != linkCmds.end();
         ++i)
       {
-#ifdef ENABLE_WIN32_NINJA_HACKS
+#ifdef _WIN32
+       // TODO TARGET_IMPLIB is empty
        cmSystemTools::ReplaceString(*i, "/implib:", "");
 #endif
       this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index cc6024b..1a8d13d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -224,11 +224,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
     return cmNinjaDeps();
 
 
-#ifndef ENABLE_WIN32_NINJA_HACKS
+#ifndef _WIN32
   const std::vector<std::string> &deps = cli->GetDepends();
   cmNinjaDeps result(deps.size());
   std::transform(deps.begin(), deps.end(), result.begin(), MapToNinjaPath());
 #else
+  // TODO The ninja generator misses a lot on Windows.
+  //      This hack avoids a problem when a Dll is build:
+  //      It builds the .dll but uses the .lib which is then unknown to ninja.
   cmNinjaDeps result;
   for(unsigned i = 0; i < cli->GetItems().size(); ++i) {
     if( cli->GetItems()[i].Target ) {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=634b293abc8b22df8585b462fdbf2d19e94f3ea7
commit 634b293abc8b22df8585b462fdbf2d19e94f3ea7
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Feb 19 19:15:57 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sun Feb 19 19:15:57 2012 +0100

    disable unfinished Windows ninja support
    
    This way the branch is ready-to-merge, even when the generator is broken on Windows.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index a53a0c1..3ae9464 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -353,23 +353,21 @@ IF (WIN32)
   ENDIF(NOT UNIX)
 ENDIF (WIN32)
 
-SET(SRCS ${SRCS}
-  cmGlobalNinjaGenerator.cxx
-  cmGlobalNinjaGenerator.h
-  cmNinjaTypes.h
-  cmLocalNinjaGenerator.cxx
-  cmLocalNinjaGenerator.h
-  cmNinjaTargetGenerator.cxx
-  cmNinjaTargetGenerator.h
-  cmNinjaNormalTargetGenerator.cxx
-  cmNinjaNormalTargetGenerator.h
-  cmNinjaUtilityTargetGenerator.cxx
-  cmNinjaUtilityTargetGenerator.h
-  )
-ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-IF(WIN32)
-  # TODO remove
-  ADD_DEFINITIONS(-DENABLE_WIN32_NINJA_HACKS)
+if(NOT WIN32)
+  SET(SRCS ${SRCS}
+    cmGlobalNinjaGenerator.cxx
+    cmGlobalNinjaGenerator.h
+    cmNinjaTypes.h
+    cmLocalNinjaGenerator.cxx
+    cmLocalNinjaGenerator.h
+    cmNinjaTargetGenerator.cxx
+    cmNinjaTargetGenerator.h
+    cmNinjaNormalTargetGenerator.cxx
+    cmNinjaNormalTargetGenerator.h
+    cmNinjaUtilityTargetGenerator.cxx
+    cmNinjaUtilityTargetGenerator.h
+    )
+  ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
 endif()
 
 # create a library used by the command line and the GUI

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa0cfca8855cac8c8cca46da222b2faeaf1c5bef
commit aa0cfca8855cac8c8cca46da222b2faeaf1c5bef
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Feb 19 11:30:07 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sun Feb 19 11:30:07 2012 +0100

    add some hacks for Windows

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e0a6f42..a53a0c1 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -367,6 +367,10 @@ SET(SRCS ${SRCS}
   cmNinjaUtilityTargetGenerator.h
   )
 ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
+IF(WIN32)
+  # TODO remove
+  ADD_DEFINITIONS(-DENABLE_WIN32_NINJA_HACKS)
+endif()
 
 # create a library used by the command line and the GUI
 ADD_LIBRARY(CMakeLib ${SRCS})
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 0174c3d..97b46bf 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -172,8 +172,7 @@ cmNinjaNormalTargetGenerator
         i != linkCmds.end();
         ++i)
       {
-#ifdef _WIN32
-       // HACK: no TARGET_IMPLIB here???
+#ifdef ENABLE_WIN32_NINJA_HACKS
        cmSystemTools::ReplaceString(*i, "/implib:", "");
 #endif
       this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8a563b6..cc6024b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -223,9 +223,19 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
   if(!cli)
     return cmNinjaDeps();
 
+
+#ifndef ENABLE_WIN32_NINJA_HACKS
   const std::vector<std::string> &deps = cli->GetDepends();
   cmNinjaDeps result(deps.size());
   std::transform(deps.begin(), deps.end(), result.begin(), MapToNinjaPath());
+#else
+  cmNinjaDeps result;
+  for(unsigned i = 0; i < cli->GetItems().size(); ++i) {
+    if( cli->GetItems()[i].Target ) {
+      result.push_back( cli->GetItems()[i].Target->GetName() );
+    }
+  }
+#endif
   return result;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01a5253316c7c7182323d4797fa13abcc03f093b
commit 01a5253316c7c7182323d4797fa13abcc03f093b
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Feb 19 11:10:18 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sun Feb 19 11:10:18 2012 +0100

    also build ninja support on Windows

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7ddabbd..e0a6f42 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -353,23 +353,20 @@ IF (WIN32)
   ENDIF(NOT UNIX)
 ENDIF (WIN32)
 
-# Ninja only works on UNIX.
-IF(UNIX)
-  SET(SRCS ${SRCS}
-    cmGlobalNinjaGenerator.cxx
-    cmGlobalNinjaGenerator.h
-    cmNinjaTypes.h
-    cmLocalNinjaGenerator.cxx
-    cmLocalNinjaGenerator.h
-    cmNinjaTargetGenerator.cxx
-    cmNinjaTargetGenerator.h
-    cmNinjaNormalTargetGenerator.cxx
-    cmNinjaNormalTargetGenerator.h
-    cmNinjaUtilityTargetGenerator.cxx
-    cmNinjaUtilityTargetGenerator.h
-    )
-  ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-ENDIF(UNIX)
+SET(SRCS ${SRCS}
+  cmGlobalNinjaGenerator.cxx
+  cmGlobalNinjaGenerator.h
+  cmNinjaTypes.h
+  cmLocalNinjaGenerator.cxx
+  cmLocalNinjaGenerator.h
+  cmNinjaTargetGenerator.cxx
+  cmNinjaTargetGenerator.h
+  cmNinjaNormalTargetGenerator.cxx
+  cmNinjaNormalTargetGenerator.h
+  cmNinjaUtilityTargetGenerator.cxx
+  cmNinjaUtilityTargetGenerator.h
+  )
+ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
 
 # create a library used by the command line and the GUI
 ADD_LIBRARY(CMakeLib ${SRCS})

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad1ebd61210fbeca6aef2ca530c74b5279907e17
commit ad1ebd61210fbeca6aef2ca530c74b5279907e17
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 03:07:21 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Feb 19 05:57:22 2012 +0000

    Shell encode the command used in custom commands

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 32f3833..687dbb8 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -334,7 +334,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
     cmdLines.push_back(cdCmd.str());
   }
   for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {
-    cmdLines.push_back(ccg.GetCommand(i));
+    cmdLines.push_back(this->ConvertToOutputFormat(ccg.GetCommand(i).c_str(),
+                                                   SHELL));
     std::string& cmd = cmdLines.back();
     ccg.AppendArguments(i, cmd);
   }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=655d5c534b86dd51e2ebf5339201605cbcb88f53
commit 655d5c534b86dd51e2ebf5339201605cbcb88f53
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 03:07:09 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Feb 19 05:57:22 2012 +0000

    Shell encode various CMake invocations

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index b1d8e5b..7c1529b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -743,12 +743,19 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
 
 void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
 {
-  cmMakefile* mfRoot = this->LocalGenerators[0]->GetMakefile();
+  cmLocalGenerator *lg = this->LocalGenerators[0];
+  cmMakefile* mfRoot = lg->GetMakefile();
 
   std::ostringstream cmd;
-  cmd << mfRoot->GetRequiredDefinition("CMAKE_COMMAND")
-      << " -H" << mfRoot->GetHomeDirectory()
-      << " -B" << mfRoot->GetHomeOutputDirectory();
+  cmd << lg->ConvertToOutputFormat(
+           mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
+           cmLocalGenerator::SHELL)
+      << " -H"
+      << lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(),
+                                   cmLocalGenerator::SHELL)
+      << " -B"
+      << lg->ConvertToOutputFormat(mfRoot->GetHomeOutputDirectory(),
+                                   cmLocalGenerator::SHELL);
   WriteRule(*this->RulesFileStream,
             "RERUN_CMAKE",
             cmd.str(),
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 4434aef..0174c3d 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -198,7 +198,9 @@ cmNinjaNormalTargetGenerator
 
   if (this->TargetNameOut != this->TargetNameReal) {
     std::string cmakeCommand =
-      this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+      this->GetLocalGenerator()->ConvertToOutputFormat(
+        this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
+        cmLocalGenerator::SHELL);
     if (targetType == cmTarget::EXECUTABLE)
       this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_EXECUTABLE",
                                           cmakeCommand +
@@ -238,7 +240,9 @@ cmNinjaNormalTargetGenerator
       // We have archive link commands set. First, delete the existing archive.
       std::vector<std::string> linkCmds;
       std::string cmakeCommand =
-        this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND");
+        this->GetLocalGenerator()->ConvertToOutputFormat(
+          this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
+          cmLocalGenerator::SHELL);
       linkCmds.push_back(cmakeCommand + " -E remove $out");
 
       // TODO: Use ARCHIVE_APPEND for archives over a certain size.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed39b1624f252347199811b9b74323dd7e9d3c0c
commit ed39b1624f252347199811b9b74323dd7e9d3c0c
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 02:46:37 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Feb 19 05:43:47 2012 +0000

    Shell encode paths used in "cd" commands

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 28e8d47..32f3833 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -325,12 +325,12 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
 {
   cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile);
   if (ccg.GetNumberOfCommands() > 0) {
+    const char* wd = cc->GetWorkingDirectory();
+    if (!wd)
+      wd = this->GetMakefile()->GetStartOutputDirectory();
+
     std::ostringstream cdCmd;
-    cdCmd << "cd ";
-    if (const char* wd = cc->GetWorkingDirectory())
-      cdCmd << wd;
-    else
-      cdCmd << this->GetMakefile()->GetStartOutputDirectory();
+    cdCmd << "cd " << this->ConvertToOutputFormat(wd, SHELL);
     cmdLines.push_back(cdCmd.str());
   }
   for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 7cce45b..4434aef 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -377,9 +377,12 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
 
   // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
   // the link commands.
-  if (!preLinkCmdLines.empty())
-    preLinkCmdLines.push_back(std::string("cd ") +
-                              this->GetMakefile()->GetHomeOutputDirectory());
+  if (!preLinkCmdLines.empty()) {
+    std::string path = this->GetLocalGenerator()->ConvertToOutputFormat(
+      this->GetMakefile()->GetHomeOutputDirectory(),
+      cmLocalGenerator::SHELL);
+    preLinkCmdLines.push_back("cd " + path);
+  }
 
   vars["PRE_LINK"] =
     this->GetLocalGenerator()->BuildCommandLine(preLinkCmdLines);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5405a8f42986010fd7cff1cf2140c83777c4c724
commit 5405a8f42986010fd7cff1cf2140c83777c4c724
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sun Feb 19 01:50:53 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Feb 19 04:00:02 2012 +0000

    Backslash rules for Windows
    
    Generally these are only required in build statements, as Ninja wants
    to be able to chop paths up.  But it doesn't hurt to also try to use
    them in command line arguments.

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index e9264ec..b1d8e5b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -84,6 +84,15 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string &lit)
   return result;
 }
 
+std::string cmGlobalNinjaGenerator::EncodePath(const std::string &path)
+{
+  std::string result = path;
+#ifdef _WIN32
+  cmSystemTools::ReplaceString(result, "/", "\\");
+#endif
+  return EncodeLiteral(result);
+}
+
 void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
                                         const std::string& comment,
                                         const std::string& rule,
@@ -122,7 +131,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
   for(cmNinjaDeps::const_iterator i = outputs.begin();
       i != outputs.end();
       ++i)
-    builds << " " << EncodeIdent(*i, os);
+    builds << " " << EncodeIdent(EncodePath(*i), os);
   builds << ":";
 
   // Write the rule.
@@ -132,7 +141,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
   for(cmNinjaDeps::const_iterator i = explicitDeps.begin();
       i != explicitDeps.end();
       ++i)
-    builds  << " " << EncodeIdent(*i, os);
+    builds  << " " << EncodeIdent(EncodePath(*i), os);
 
   // Write implicit dependencies.
   if(!implicitDeps.empty())
@@ -141,7 +150,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
     for(cmNinjaDeps::const_iterator i = implicitDeps.begin();
         i != implicitDeps.end();
         ++i)
-      builds  << " " << EncodeIdent(*i, os);
+      builds  << " " << EncodeIdent(EncodePath(*i), os);
     }
 
   // Write order-only dependencies.
@@ -151,7 +160,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
     for(cmNinjaDeps::const_iterator i = orderOnlyDeps.begin();
         i != orderOnlyDeps.end();
         ++i)
-      builds  << " " << EncodeIdent(*i, os);
+      builds  << " " << EncodeIdent(EncodePath(*i), os);
     }
 
   builds << "\n";
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 6f3c6b2..3f8644e 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -59,6 +59,7 @@ public:
 
   static std::string EncodeIdent(const std::string &ident, std::ostream &vars);
   static std::string EncodeLiteral(const std::string &lit);
+  static std::string EncodePath(const std::string &path);
 
   /**
    * Write the given @a comment to the output stream @a os. It
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index cf0e36a..28e8d47 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -28,6 +28,9 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator()
   , HomeRelativeOutputPath("")
 {
   this->IsMakefileGenerator = true;
+#ifdef _WIN32
+  this->WindowsShell = true;
+#endif
 }
 
 //----------------------------------------------------------------------------
@@ -256,9 +259,11 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
 
 std::string cmLocalNinjaGenerator::ConvertToNinjaPath(const char *path)
 {
-  return this->Convert(path,
-                       cmLocalGenerator::HOME_OUTPUT,
-                       cmLocalGenerator::MAKEFILE);
+  std::string convPath = this->Convert(path, cmLocalGenerator::HOME_OUTPUT);
+#ifdef _WIN32
+  cmSystemTools::ReplaceString(convPath, "/", "\\");
+#endif
+  return convPath;
 }
 
 void
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1e31044..8a563b6 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -212,13 +212,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
   return defines;
 }
 
-std::string cmNinjaTargetGenerator::ConvertToNinjaPath(const char *path) const
-{
-  return this->LocalGenerator->Convert(path,
-                                       cmLocalGenerator::HOME_OUTPUT,
-                                       cmLocalGenerator::MAKEFILE);
-}
-
 cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
 {
   // Static libraries never depend on other targets for linking.
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index cf47abf..2986844 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -75,7 +75,9 @@ protected:
   std::string ComputeDefines(cmSourceFile *source,
                              const std::string& language);
 
-  std::string ConvertToNinjaPath(const char *path) const;
+  std::string ConvertToNinjaPath(const char *path) const {
+    return this->GetLocalGenerator()->ConvertToNinjaPath(path);
+  }
   cmLocalNinjaGenerator::map_to_ninja_path MapToNinjaPath() const {
     return this->GetLocalGenerator()->MapToNinjaPath();
   }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50583a17c02d18e402c73f92e761f7ddfe623270
commit 50583a17c02d18e402c73f92e761f7ddfe623270
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sat Feb 18 19:04:55 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sat Feb 18 20:33:39 2012 +0000

    Identifier encoding rules for ' ' and ':'

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7ff33ba..e9264ec 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -56,7 +56,8 @@ static bool IsIdentChar(char c)
     ('a' <= c && c <= 'z') ||
     ('+' <= c && c <= '9') ||  // +,-./ and numbers
     ('A' <= c && c <= 'Z') ||
-    (c == '_') || (c == '$') || (c == '\\');
+    (c == '_') || (c == '$') || (c == '\\') ||
+    (c == ' ') || (c == ':');
 }
 
 std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
@@ -69,7 +70,10 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
     vars << names.str() << " = " << ident << "\n";
     return "$" + names.str();
   } else {
-    return ident;
+    std::string result = ident;
+    cmSystemTools::ReplaceString(result, " ", "$ ");
+    cmSystemTools::ReplaceString(result, ":", "$:");
+    return result;
   }
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=192849a496f3ddd765f5fec3d55dc4ccbef535de
commit 192849a496f3ddd765f5fec3d55dc4ccbef535de
Author:     Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sat Feb 18 16:32:47 2012 +0000
Commit:     Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sat Feb 18 20:33:33 2012 +0000

    Partially revert "win fixes: escape back slash/colon, use cd. as cmd.exe nop"
    
    It introduced encoding rules in the wrong place, and broke the
    CustomCommand test case.
    
    This reverts commit 574112221edc2e2437ea766cdb2cb6263cb832a4.

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7cc56d7..7ddabbd 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -353,8 +353,9 @@ IF (WIN32)
   ENDIF(NOT UNIX)
 ENDIF (WIN32)
 
-
-SET(SRCS ${SRCS}
+# Ninja only works on UNIX.
+IF(UNIX)
+  SET(SRCS ${SRCS}
     cmGlobalNinjaGenerator.cxx
     cmGlobalNinjaGenerator.h
     cmNinjaTypes.h
@@ -367,8 +368,8 @@ SET(SRCS ${SRCS}
     cmNinjaUtilityTargetGenerator.cxx
     cmNinjaUtilityTargetGenerator.h
     )
-ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-
+  ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
+ENDIF(UNIX)
 
 # create a library used by the command line and the GUI
 ADD_LIBRARY(CMakeLib ${SRCS})
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 879a973..7ff33ba 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -59,7 +59,6 @@ static bool IsIdentChar(char c)
     (c == '_') || (c == '$') || (c == '\\');
 }
 
-
 std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
                                                 std::ostream &vars) {
   if (std::find_if(ident.begin(), ident.end(),
@@ -70,19 +69,14 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
     vars << names.str() << " = " << ident << "\n";
     return "$" + names.str();
   } else {
-    return EncodeLiteral(ident);
+    return ident;
   }
 }
 
-
 std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string &lit)
 {
   std::string result = lit;
   cmSystemTools::ReplaceString(result, "$", "$$");
-  cmSystemTools::ReplaceString(result, ":", "$:");
-#ifdef _WIN32
-  cmSystemTools::ReplaceString(result, "/", "\\");
-#endif
   return result;
 }
 
@@ -206,8 +200,7 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
   this->AddCustomCommandRule();
 
   cmNinjaVars vars;
-
-  vars["COMMAND"] = EncodeLiteral(command);
+  vars["COMMAND"] = command;
   vars["DESC"] = EncodeLiteral(description);
 
   cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7e53d28c7211ac052e276238eeb25a6025dadf0
commit e7e53d28c7211ac052e276238eeb25a6025dadf0
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sat Feb 18 11:24:41 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sat Feb 18 11:24:41 2012 +0100

    don't define MSVC_IDE when using the ninja generator
    
    Thanks to Oscar Fuentes

diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index ccccbc9..be6abb6 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -37,7 +37,7 @@ SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
 # that is automatically copied into try_compile directories
 # by the global generator.
 SET(MSVC_IDE 1)
-IF(CMAKE_GENERATOR MATCHES "Makefiles")
+IF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
   SET(MSVC_IDE 0)
   IF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
     SET(CMAKE_VC_COMPILER_TESTS 1)
@@ -125,7 +125,7 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
     ENDIF(CMAKE_COMPILER_RETURN)
     MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
   ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
-ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
+ENDIF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja")
 
 IF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
   SET(CMAKE_CL_64 1)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=574112221edc2e2437ea766cdb2cb6263cb832a4
commit 574112221edc2e2437ea766cdb2cb6263cb832a4
Author:     Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sat Feb 18 08:07:11 2012 +0100
Commit:     Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sat Feb 18 08:15:23 2012 +0100

    win fixes: escape back slash/colon, use cd. as cmd.exe nop

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7ddabbd..7cc56d7 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -353,9 +353,8 @@ IF (WIN32)
   ENDIF(NOT UNIX)
 ENDIF (WIN32)
 
-# Ninja only works on UNIX.
-IF(UNIX)
-  SET(SRCS ${SRCS}
+
+SET(SRCS ${SRCS}
     cmGlobalNinjaGenerator.cxx
     cmGlobalNinjaGenerator.h
     cmNinjaTypes.h
@@ -368,8 +367,8 @@ IF(UNIX)
     cmNinjaUtilityTargetGenerator.cxx
     cmNinjaUtilityTargetGenerator.h
     )
-  ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
-ENDIF(UNIX)
+ADD_DEFINITIONS(-DCMAKE_USE_NINJA)
+
 
 # create a library used by the command line and the GUI
 ADD_LIBRARY(CMakeLib ${SRCS})
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 7ff33ba..879a973 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -59,6 +59,7 @@ static bool IsIdentChar(char c)
     (c == '_') || (c == '$') || (c == '\\');
 }
 
+
 std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
                                                 std::ostream &vars) {
   if (std::find_if(ident.begin(), ident.end(),
@@ -69,14 +70,19 @@ std::string cmGlobalNinjaGenerator::EncodeIdent(const std::string &ident,
     vars << names.str() << " = " << ident << "\n";
     return "$" + names.str();
   } else {
-    return ident;
+    return EncodeLiteral(ident);
   }
 }
 
+
 std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string &lit)
 {
   std::string result = lit;
   cmSystemTools::ReplaceString(result, "$", "$$");
+  cmSystemTools::ReplaceString(result, ":", "$:");
+#ifdef _WIN32
+  cmSystemTools::ReplaceString(result, "/", "\\");
+#endif
   return result;
 }
 
@@ -200,7 +206,8 @@ cmGlobalNinjaGenerator::WriteCustomCommandBuild(const std::string& command,
   this->AddCustomCommandRule();
 
   cmNinjaVars vars;
-  vars["COMMAND"] = command;
+
+  vars["COMMAND"] = EncodeLiteral(command);
   vars["DESC"] = EncodeLiteral(description);
 
   cmGlobalNinjaGenerator::WriteBuild(*this->BuildFileStream,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a4e66e4..cf0e36a 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -294,7 +294,11 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
   // This happens when building a POST_BUILD value for link targets that
   // don't use POST_BUILD.
   if (cmdLines.empty())
+#ifdef _WIN32
+    return "cd.";
+#else
     return ":";
+#endif
 
   // TODO: This will work only on Unix platforms. I don't
   // want to use a link.txt file because I will lose the benefit of the
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 4dd6a9b..7cce45b 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -172,6 +172,10 @@ cmNinjaNormalTargetGenerator
         i != linkCmds.end();
         ++i)
       {
+#ifdef _WIN32
+       // HACK: no TARGET_IMPLIB here???
+       cmSystemTools::ReplaceString(*i, "/implib:", "");
+#endif
       this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
       }
     linkCmds.insert(linkCmds.begin(), "$PRE_LINK");

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

Summary of changes:
 Modules/Platform/Windows-cl.cmake       |    4 +-
 Source/CMakeLists.txt                   |    5 +--
 Source/cmGlobalNinjaGenerator.cxx       |   40 +++++++++++++++++++++++-------
 Source/cmGlobalNinjaGenerator.h         |    1 +
 Source/cmLocalNinjaGenerator.cxx        |   29 +++++++++++++++-------
 Source/cmNinjaNormalTargetGenerator.cxx |   34 ++++++++++++++++++++++----
 Source/cmNinjaTargetGenerator.cxx       |    7 -----
 Source/cmNinjaTargetGenerator.h         |    4 ++-
 8 files changed, 87 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list