[Cmake-commits] CMake branch, master, updated. v3.8.1-1329-gf8642f9

Kitware Robot kwrobot at kitware.com
Sun May 28 09:15:03 EDT 2017


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, master has been updated
       via  f8642f953d3d8547bd31fcb35a4737fa91d9126f (commit)
       via  f9ea6247c10fa0b39977f9b75d266e7282b19a1b (commit)
       via  5a0fa11fec8f9cf4ad53defdb4b389aab77ccb2f (commit)
       via  8b96e31ca3e9481da9a110c0891bff19744fd432 (commit)
       via  2c2bb5f527b4c0e0eca7867492c046be23818c9a (commit)
       via  1e4e2f993c5914d329cbee355035166e12151081 (commit)
       via  25486156305dc0693366c0c7e5dc6c7035ab49a9 (commit)
       via  86dc86dd6c66a6d61234efcddddddf466a6597d2 (commit)
       via  1ee2019239751f91958a390aa3dfa24ea603f2f5 (commit)
       via  cc329a01258ecc7f4debbae94baf067136617c65 (commit)
       via  e3e692caeaae920a920aebebdd229f4d5ddf0af8 (commit)
       via  dbda590628868e37956838c1d93d54050ab3e7c1 (commit)
       via  0965002e57f7461d290792252b289fda9247d530 (commit)
       via  76bdb4076277cda0e68e1d80cdf715020eab5a7a (commit)
      from  bc341a9d5e3863dd80393144eae88f27883db764 (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=f8642f953d3d8547bd31fcb35a4737fa91d9126f
commit f8642f953d3d8547bd31fcb35a4737fa91d9126f
Merge: f9ea624 2c2bb5f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sun May 28 13:13:06 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sun May 28 09:13:12 2017 -0400

    Merge topic 'reduce-string-copying'
    
    2c2bb5f5 Remove unnecessary operator<< usage
    1e4e2f99 Remove unused variables
    25486156 Improved checking for number of arguments passed
    86dc86dd Add const-reference qualifications
    76bdb407 Change std::basic_string<char> to std::string
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !886


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9ea6247c10fa0b39977f9b75d266e7282b19a1b
commit f9ea6247c10fa0b39977f9b75d266e7282b19a1b
Merge: 5a0fa11 cc329a0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sun May 28 13:11:58 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sun May 28 09:12:04 2017 -0400

    Merge topic 'FindBoost-use-IN_LIST'
    
    cc329a01 FindBoost: Simplify search in lists.
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !750


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a0fa11fec8f9cf4ad53defdb4b389aab77ccb2f
commit 5a0fa11fec8f9cf4ad53defdb4b389aab77ccb2f
Merge: 8b96e31 e3e692c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sun May 28 13:11:26 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sun May 28 09:11:33 2017 -0400

    Merge topic 'autogen_config'
    
    e3e692ca Autogen: Test adaptions
    dbda5906 Autogen: Per-config file suffixes. New AUTOGEN_BUILD_DIR target property.
    0965002e Autogen: Pass build directory in Info file
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !858


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b96e31ca3e9481da9a110c0891bff19744fd432
commit 8b96e31ca3e9481da9a110c0891bff19744fd432
Merge: bc341a9 1ee2019
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Sun May 28 13:09:40 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sun May 28 09:09:46 2017 -0400

    Merge topic 'FindProtobuf-export-macro'
    
    1ee20192 FindProtobuf: add optional export declaration macro to generated cpp files
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !881


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c2bb5f527b4c0e0eca7867492c046be23818c9a
commit 2c2bb5f527b4c0e0eca7867492c046be23818c9a
Author:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
AuthorDate: Fri May 26 19:54:29 2017 +0300
Commit:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
CommitDate: Fri May 26 19:54:29 2017 +0300

    Remove unnecessary operator<< usage

diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 88fcb12..e1e165c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -56,7 +56,7 @@ void cmGlobalNinjaGenerator::Indent(std::ostream& os, int count)
 void cmGlobalNinjaGenerator::WriteDivider(std::ostream& os)
 {
   os << "# ======================================"
-     << "=======================================\n";
+        "=======================================\n";
 }
 
 void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1e4e2f993c5914d329cbee355035166e12151081
commit 1e4e2f993c5914d329cbee355035166e12151081
Author:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
AuthorDate: Fri May 26 19:52:31 2017 +0300
Commit:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
CommitDate: Fri May 26 19:52:31 2017 +0300

    Remove unused variables

diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index ea5379a..adab061 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -600,9 +600,6 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
   // which may have an acompanying header, one for all other files
   std::string projectType;
 
-  std::vector<std::string> headerExts =
-    this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
-
   std::map<std::string, cmSourceFile*> cFiles;
   std::set<std::string> otherFiles;
 
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 332fa83..beddc6e 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -48,8 +48,6 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
   cmSystemTools::MakeDirectory(out.c_str());
   this->Makefile->AddCMakeOutputFile(out);
 
-  std::string newoutpath = out;
-
   // Configure the Info.plist file.  Note that it needs the executable name
   // to be set.
   std::string plist = outpath;
@@ -60,7 +58,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName,
   this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName,
                                                plist.c_str());
   this->Makefile->AddCMakeOutputFile(plist);
-  outpath = newoutpath;
+  outpath = out;
 }
 
 void cmOSXBundleGenerator::CreateFramework(const std::string& targetName,
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 9f9cc6f..dc7034e 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -196,7 +196,6 @@ void cmSystemTools::ExpandRegistryValues(std::string& source,
   while (regEntry.find(source)) {
     // the arguments are the second match
     std::string key = regEntry.match(1);
-    std::string val;
     std::string reg = "[";
     reg += key + "]";
     cmSystemTools::ReplaceString(source, reg.c_str(), "/registry");

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25486156305dc0693366c0c7e5dc6c7035ab49a9
commit 25486156305dc0693366c0c7e5dc6c7035ab49a9
Author:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
AuthorDate: Fri May 26 19:51:40 2017 +0300
Commit:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
CommitDate: Fri May 26 19:51:40 2017 +0300

    Improved checking for number of arguments passed

diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index 8e34cb1..847a416 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -18,7 +18,7 @@ class cmExecutionStatus;
 bool cmAuxSourceDirectoryCommand::InitialPass(
   std::vector<std::string> const& args, cmExecutionStatus&)
 {
-  if (args.size() < 2 || args.size() > 2) {
+  if (args.size() != 2) {
     this->SetError("called with incorrect number of arguments");
     return false;
   }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=86dc86dd6c66a6d61234efcddddddf466a6597d2
commit 86dc86dd6c66a6d61234efcddddddf466a6597d2
Author:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
AuthorDate: Wed May 24 23:18:28 2017 +0300
Commit:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
CommitDate: Fri May 26 19:50:11 2017 +0300

    Add const-reference qualifications

diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index 0d01493..5db6e09 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -24,7 +24,7 @@ bool cmAddCustomTargetCommand::InitialPass(
     return false;
   }
 
-  std::string targetName = args[0];
+  std::string const& targetName = args[0];
 
   // Check the target name.
   if (targetName.find_first_of("/\\") != targetName.npos) {
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index e49d5d5..a73b57e 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -19,7 +19,7 @@ bool cmAddDependenciesCommand::InitialPass(
     return false;
   }
 
-  std::string target_name = args[0];
+  std::string const& target_name = args[0];
   if (this->Makefile->IsAlias(target_name)) {
     std::ostringstream e;
     e << "Cannot add target-level dependencies to alias target \""
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx
index aae1085..1d0376f 100644
--- a/Source/cmAddExecutableCommand.cxx
+++ b/Source/cmAddExecutableCommand.cxx
@@ -24,7 +24,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args,
   }
   std::vector<std::string>::const_iterator s = args.begin();
 
-  std::string exename = *s;
+  std::string const& exename = *s;
 
   ++s;
   bool use_win32 = false;
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 0bdf963..ebf1763 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -37,7 +37,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args,
 
   std::vector<std::string>::const_iterator s = args.begin();
 
-  std::string libName = *s;
+  std::string const& libName = *s;
 
   ++s;
 
diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx
index dbd4dd1..1727ca5 100644
--- a/Source/cmAddSubDirectoryCommand.cxx
+++ b/Source/cmAddSubDirectoryCommand.cxx
@@ -20,7 +20,7 @@ bool cmAddSubDirectoryCommand::InitialPass(
   }
 
   // store the binpath
-  std::string srcArg = args[0];
+  std::string const& srcArg = args[0];
   std::string binArg;
 
   bool excludeFromAll = false;
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx
index c92c47b..8e34cb1 100644
--- a/Source/cmAuxSourceDirectoryCommand.cxx
+++ b/Source/cmAuxSourceDirectoryCommand.cxx
@@ -24,7 +24,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
   }
 
   std::string sourceListValue;
-  std::string templateDirectory = args[0];
+  std::string const& templateDirectory = args[0];
   std::string tdir;
   if (!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) {
     tdir = this->Makefile->GetCurrentSourceDirectory();
@@ -54,7 +54,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(
         std::string ext = file.substr(dotpos + 1);
         std::string base = file.substr(0, dotpos);
         // Process only source files
-        std::vector<std::string> srcExts =
+        std::vector<std::string> const& srcExts =
           this->Makefile->GetCMakeInstance()->GetSourceExtensions();
         if (!base.empty() &&
             std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end()) {
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 6836151..fd87600 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -32,7 +32,7 @@ bool cmBuildCommand::MainSignature(std::vector<std::string> const& args)
   }
 
   // The cmake variable in which to store the result.
-  const char* variable = args[0].c_str();
+  std::string const& variable = args[0];
 
   // Parse remaining arguments.
   std::string configuration;
@@ -104,7 +104,7 @@ bool cmBuildCommand::TwoArgsSignature(std::vector<std::string> const& args)
     return false;
   }
 
-  const char* define = args[0].c_str();
+  std::string const& define = args[0];
   const char* cacheValue = this->Makefile->GetDefinition(define);
 
   std::string configType;
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index e135ac6..4475c5a 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -26,7 +26,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
     return false;
   }
 
-  std::string variable = args[current_index + 1];
+  std::string const& variable = args[current_index + 1];
   current_index += 2;
 
   if (args.size() < (current_index + 2) || args[current_index] != "QUERY") {
@@ -41,7 +41,7 @@ bool cmCMakeHostSystemInformationCommand::InitialPass(
 
   std::string result_list;
   for (size_t i = current_index + 1; i < args.size(); ++i) {
-    std::string key = args[i];
+    std::string const& key = args[i];
     if (i != current_index + 1) {
       result_list += ";";
     }
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx
index b9c7549..18005f2 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -19,7 +19,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
     return false;
   }
 
-  const char* inFile = args[0].c_str();
+  std::string const& inFile = args[0];
   if (!cmSystemTools::FileIsFullPath(inFile)) {
     this->InputFile = this->Makefile->GetCurrentSourceDirectory();
     this->InputFile += "/";
@@ -38,7 +38,7 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
     return false;
   }
 
-  const char* outFile = args[1].c_str();
+  std::string const& outFile = args[1];
   if (!cmSystemTools::FileIsFullPath(outFile)) {
     this->OutputFile = this->Makefile->GetCurrentBinaryDirectory();
     this->OutputFile += "/";
diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx
index 9a097f3..86a83da 100644
--- a/Source/cmDefinePropertyCommand.cxx
+++ b/Source/cmDefinePropertyCommand.cxx
@@ -20,23 +20,25 @@ bool cmDefinePropertyCommand::InitialPass(std::vector<std::string> const& args,
 
   // Get the scope in which to define the property.
   cmProperty::ScopeType scope;
-  if (args[0] == "GLOBAL") {
+  std::string const& scope_arg = args[0];
+
+  if (scope_arg == "GLOBAL") {
     scope = cmProperty::GLOBAL;
-  } else if (args[0] == "DIRECTORY") {
+  } else if (scope_arg == "DIRECTORY") {
     scope = cmProperty::DIRECTORY;
-  } else if (args[0] == "TARGET") {
+  } else if (scope_arg == "TARGET") {
     scope = cmProperty::TARGET;
-  } else if (args[0] == "SOURCE") {
+  } else if (scope_arg == "SOURCE") {
     scope = cmProperty::SOURCE_FILE;
-  } else if (args[0] == "TEST") {
+  } else if (scope_arg == "TEST") {
     scope = cmProperty::TEST;
-  } else if (args[0] == "VARIABLE") {
+  } else if (scope_arg == "VARIABLE") {
     scope = cmProperty::VARIABLE;
-  } else if (args[0] == "CACHED_VARIABLE") {
+  } else if (scope_arg == "CACHED_VARIABLE") {
     scope = cmProperty::CACHED_VARIABLE;
   } else {
     std::ostringstream e;
-    e << "given invalid scope " << args[0] << ".  "
+    e << "given invalid scope " << scope_arg << ".  "
       << "Valid scopes are "
       << "GLOBAL, DIRECTORY, TARGET, SOURCE, "
       << "TEST, VARIABLE, CACHED_VARIABLE.";
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2dffcaa..5b7b827 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -353,7 +353,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
   all_files_map_t allFiles;
   std::vector<std::string> cFiles;
 
-  std::vector<std::string> srcExts =
+  std::vector<std::string> const& srcExts =
     this->GlobalGenerator->GetCMakeInstance()->GetSourceExtensions();
 
   for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin();
@@ -387,7 +387,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
             bool isCFile = false;
             std::string lang = (*si)->GetLanguage();
             if (lang == "C" || lang == "CXX") {
-              std::string srcext = (*si)->GetExtension();
+              std::string const& srcext = (*si)->GetExtension();
               for (std::vector<std::string>::const_iterator ext =
                      srcExts.begin();
                    ext != srcExts.end(); ++ext) {
@@ -398,7 +398,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
               }
             }
 
-            std::string fullPath = (*si)->GetFullPath();
+            std::string const& fullPath = (*si)->GetFullPath();
 
             if (isCFile) {
               cFiles.push_back(fullPath);
@@ -414,7 +414,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
     }
   }
 
-  std::vector<std::string> headerExts =
+  std::vector<std::string> const& headerExts =
     this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
 
   // The following loop tries to add header files matching to implementation
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 98eebe6..ea5379a 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -240,7 +240,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
         bool isCFile = false;
         std::string lang = (*si)->GetLanguage();
         if (lang == "C" || lang == "CXX") {
-          std::string srcext = (*si)->GetExtension();
+          std::string const& srcext = (*si)->GetExtension();
           for (std::vector<std::string>::const_iterator ext = srcExts.begin();
                ext != srcExts.end(); ++ext) {
             if (srcext == *ext) {
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 8d1adc7..2a6ce98 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -453,7 +453,7 @@ void cmExtraEclipseCDT4Generator::WriteGroups(
     for (std::vector<const cmSourceFile*>::const_iterator fileIt =
            sFiles.begin();
          fileIt != sFiles.end(); ++fileIt) {
-      std::string fullPath = (*fileIt)->GetFullPath();
+      std::string const& fullPath = (*fileIt)->GetFullPath();
 
       if (!cmSystemTools::FileIsDirectory(fullPath)) {
         std::string linkName4 = linkName3;
@@ -508,7 +508,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
           for (std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
                sfIt != files.end(); sfIt++) {
             // Add the file to the list of sources.
-            std::string source = (*sfIt)->GetFullPath();
+            std::string const& source = (*sfIt)->GetFullPath();
             cmSourceGroup* sourceGroup =
               makefile->FindSourceGroup(source.c_str(), sourceGroups);
             sourceGroup->AssignSource(*sfIt);
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index ff6e2b7..32a539c 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -110,7 +110,7 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
     this->SetError("must be called with at least two arguments.");
     return false;
   }
-  std::string subCommand = args[0];
+  std::string const& subCommand = args[0];
   if (subCommand == "WRITE") {
     return this->HandleWriteCommand(args, false);
   }
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 6f6a3f6..fd67d6c 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -924,7 +924,7 @@ bool cmFindPackageCommand::FindConfig()
 
 bool cmFindPackageCommand::FindPrefixedConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  std::vector<std::string> const& prefixes = this->SearchPaths;
   for (std::vector<std::string>::const_iterator pi = prefixes.begin();
        pi != prefixes.end(); ++pi) {
     if (this->SearchPrefix(*pi)) {
@@ -936,7 +936,7 @@ bool cmFindPackageCommand::FindPrefixedConfig()
 
 bool cmFindPackageCommand::FindFrameworkConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  std::vector<std::string> const& prefixes = this->SearchPaths;
   for (std::vector<std::string>::const_iterator i = prefixes.begin();
        i != prefixes.end(); ++i) {
     if (this->SearchFrameworkPrefix(*i)) {
@@ -948,7 +948,7 @@ bool cmFindPackageCommand::FindFrameworkConfig()
 
 bool cmFindPackageCommand::FindAppBundleConfig()
 {
-  std::vector<std::string>& prefixes = this->SearchPaths;
+  std::vector<std::string> const& prefixes = this->SearchPaths;
   for (std::vector<std::string>::const_iterator i = prefixes.begin();
        i != prefixes.end(); ++i) {
     if (this->SearchAppBundlePrefix(*i)) {
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 7962da6..5ba3326 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -20,7 +20,7 @@ bool cmGetCMakePropertyCommand::InitialPass(
     return false;
   }
 
-  std::string variable = args[0];
+  std::string const& variable = args[0];
   std::string output = "NOTFOUND";
 
   if (args[1] == "VARIABLES") {
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 920e1a0..6cb8e19 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -20,7 +20,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
   }
 
   std::vector<std::string>::const_iterator i = args.begin();
-  std::string variable = *i;
+  std::string const& variable = *i;
   ++i;
 
   // get the directory argument if there is one
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 509ef95..1a5f08e 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -15,8 +15,8 @@ bool cmGetSourceFilePropertyCommand::InitialPass(
     this->SetError("called with incorrect number of arguments");
     return false;
   }
-  const char* var = args[0].c_str();
-  const char* file = args[1].c_str();
+  std::string const& var = args[0];
+  std::string const& file = args[1];
   cmSourceFile* sf = this->Makefile->GetSource(file);
 
   // for the location we must create a source file first
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 2379292..0910a53 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -22,8 +22,8 @@ bool cmGetTargetPropertyCommand::InitialPass(
     this->SetError("called with incorrect number of arguments");
     return false;
   }
-  std::string var = args[0];
-  const std::string& targetName = args[1];
+  std::string const& var = args[0];
+  std::string const& targetName = args[1];
   std::string prop;
   bool prop_exists = false;
 
diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx
index a8a44b7..6424515 100644
--- a/Source/cmGetTestPropertyCommand.cxx
+++ b/Source/cmGetTestPropertyCommand.cxx
@@ -16,8 +16,8 @@ bool cmGetTestPropertyCommand::InitialPass(
     return false;
   }
 
-  std::string testName = args[0];
-  std::string var = args[2];
+  std::string const& testName = args[0];
+  std::string const& var = args[2];
   cmTest* test = this->Makefile->GetTest(testName);
   if (test) {
     const char* prop = CM_NULLPTR;
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index a958a17..e72c6e3 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -101,7 +101,7 @@ bool cmGlobalKdevelopGenerator::CreateFilelistFile(
   std::set<std::string> files;
   std::string tmp;
 
-  std::vector<std::string> hdrExts =
+  std::vector<std::string> const& hdrExts =
     this->GlobalGenerator->GetCMakeInstance()->GetHeaderExtensions();
 
   for (std::vector<cmLocalGenerator*>::const_iterator it = lgs.begin();
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index ba554aa..93e467c 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -75,29 +75,31 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args,
     this->DefaultComponentName = "Unspecified";
   }
 
+  std::string const& mode = args[0];
+
   // Switch among the command modes.
-  if (args[0] == "SCRIPT") {
+  if (mode == "SCRIPT") {
     return this->HandleScriptMode(args);
   }
-  if (args[0] == "CODE") {
+  if (mode == "CODE") {
     return this->HandleScriptMode(args);
   }
-  if (args[0] == "TARGETS") {
+  if (mode == "TARGETS") {
     return this->HandleTargetsMode(args);
   }
-  if (args[0] == "FILES") {
+  if (mode == "FILES") {
     return this->HandleFilesMode(args);
   }
-  if (args[0] == "PROGRAMS") {
+  if (mode == "PROGRAMS") {
     return this->HandleFilesMode(args);
   }
-  if (args[0] == "DIRECTORY") {
+  if (mode == "DIRECTORY") {
     return this->HandleDirectoryMode(args);
   }
-  if (args[0] == "EXPORT") {
+  if (mode == "EXPORT") {
     return this->HandleExportMode(args);
   }
-  if (args[0] == "EXPORT_ANDROID_MK") {
+  if (mode == "EXPORT_ANDROID_MK") {
     return this->HandleExportAndroidMKMode(args);
   }
 
@@ -165,7 +167,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
         script.c_str(), false, component.c_str(), exclude_from_all));
     } else if (doing_code) {
       doing_code = false;
-      std::string code = args[i];
+      std::string const& code = args[i];
       this->Makefile->AddInstallGenerator(new cmInstallScriptGenerator(
         code.c_str(), true, component.c_str(), exclude_from_all));
     }
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 86fd46d..4a3b620 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -54,7 +54,7 @@ void cmInstallFilesCommand::FinalPass()
   }
 
   std::string testf;
-  std::string ext = this->FinalArgs[0];
+  std::string const& ext = this->FinalArgs[0];
 
   // two different options
   if (this->FinalArgs.size() > 1) {
@@ -64,7 +64,7 @@ void cmInstallFilesCommand::FinalPass()
     // for each argument, get the files
     for (; s != this->FinalArgs.end(); ++s) {
       // replace any variables
-      std::string temps = *s;
+      std::string const& temps = *s;
       if (!cmSystemTools::GetFilenamePath(temps).empty()) {
         testf = cmSystemTools::GetFilenamePath(temps) + "/" +
           cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
@@ -78,7 +78,7 @@ void cmInstallFilesCommand::FinalPass()
   } else // reg exp list
   {
     std::vector<std::string> files;
-    std::string regex = this->FinalArgs[0];
+    std::string const& regex = this->FinalArgs[0];
     cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), regex,
                         files);
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 307024a..e48378d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2258,7 +2258,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
 {
   // Construct the object file name using the full path to the source
   // file which is its only unique identification.
-  const char* fullPath = source.GetFullPath().c_str();
+  std::string const& fullPath = source.GetFullPath();
 
   // Try referencing the source relative to the source tree.
   std::string relFromSource =
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a8350b3..266710c 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -213,7 +213,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
     std::vector<std::string> pools;
     cmSystemTools::ExpandListArgument(jobpools, pools);
     for (size_t i = 0; i < pools.size(); ++i) {
-      const std::string pool = pools[i];
+      std::string const& pool = pools[i];
       const std::string::size_type eq = pool.find('=');
       unsigned int jobs;
       if (eq != std::string::npos &&
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index b2f0d22..14fd96f 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -30,7 +30,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector<std::string> const& args,
     i = 1;
   }
   for (; i < args.size(); ++i) {
-    std::string variable = args[i];
+    std::string const& variable = args[i];
     cmState* state = this->Makefile->GetState();
     if (!state->GetCacheEntryValue(variable)) {
       this->Makefile->GetCMakeInstance()->AddCacheEntry(
diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx
index 55451ff..5500eba 100644
--- a/Source/cmNewLineStyle.cxx
+++ b/Source/cmNewLineStyle.cxx
@@ -23,7 +23,7 @@ bool cmNewLineStyle::ReadFromArguments(const std::vector<std::string>& args,
     if (args[i] == "NEWLINE_STYLE") {
       size_t const styleIndex = i + 1;
       if (args.size() > styleIndex) {
-        const std::string eol = args[styleIndex];
+        std::string const& eol = args[styleIndex];
         if (eol == "LF" || eol == "UNIX") {
           NewLineStyle = LF;
           return true;
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index d47a047..d72c790 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -22,11 +22,14 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
     this->SetError("PROJECT called with incorrect number of arguments");
     return false;
   }
-  this->Makefile->SetProjectName(args[0]);
 
-  std::string bindir = args[0];
+  std::string const& projectName = args[0];
+
+  this->Makefile->SetProjectName(projectName);
+
+  std::string bindir = projectName;
   bindir += "_BINARY_DIR";
-  std::string srcdir = args[0];
+  std::string srcdir = projectName;
   srcdir += "_SOURCE_DIR";
 
   this->Makefile->AddCacheDefinition(
@@ -44,7 +47,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
   this->Makefile->AddDefinition(srcdir,
                                 this->Makefile->GetCurrentSourceDirectory());
 
-  this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());
+  this->Makefile->AddDefinition("PROJECT_NAME", projectName.c_str());
 
   // Set the CMAKE_PROJECT_NAME variable to be the highest-level
   // project name in the tree. If there are two project commands
@@ -54,10 +57,10 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
   // will work.
   if (!this->Makefile->GetDefinition("CMAKE_PROJECT_NAME") ||
       (this->Makefile->IsRootMakefile())) {
-    this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str());
-    this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(),
-                                       "Value Computed by CMake",
-                                       cmStateEnums::STATIC);
+    this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", projectName.c_str());
+    this->Makefile->AddCacheDefinition(
+      "CMAKE_PROJECT_NAME", projectName.c_str(), "Value Computed by CMake",
+      cmStateEnums::STATIC);
   }
 
   bool haveVersion = false;
@@ -163,19 +166,19 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
     }
 
     std::string vv;
-    vv = args[0] + "_VERSION";
+    vv = projectName + "_VERSION";
     this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str());
     this->Makefile->AddDefinition(vv, vs.c_str());
-    vv = args[0] + "_VERSION_MAJOR";
+    vv = projectName + "_VERSION_MAJOR";
     this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]);
     this->Makefile->AddDefinition(vv, vb[0]);
-    vv = args[0] + "_VERSION_MINOR";
+    vv = projectName + "_VERSION_MINOR";
     this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]);
     this->Makefile->AddDefinition(vv, vb[1]);
-    vv = args[0] + "_VERSION_PATCH";
+    vv = projectName + "_VERSION_PATCH";
     this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]);
     this->Makefile->AddDefinition(vv, vb[2]);
-    vv = args[0] + "_VERSION_TWEAK";
+    vv = projectName + "_VERSION_TWEAK";
     this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]);
     this->Makefile->AddDefinition(vv, vb[3]);
   } else if (cmp0048 != cmPolicies::OLD) {
@@ -186,11 +189,11 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
     vv.push_back("PROJECT_VERSION_MINOR");
     vv.push_back("PROJECT_VERSION_PATCH");
     vv.push_back("PROJECT_VERSION_TWEAK");
-    vv.push_back(args[0] + "_VERSION");
-    vv.push_back(args[0] + "_VERSION_MAJOR");
-    vv.push_back(args[0] + "_VERSION_MINOR");
-    vv.push_back(args[0] + "_VERSION_PATCH");
-    vv.push_back(args[0] + "_VERSION_TWEAK");
+    vv.push_back(projectName + "_VERSION");
+    vv.push_back(projectName + "_VERSION_MAJOR");
+    vv.push_back(projectName + "_VERSION_MINOR");
+    vv.push_back(projectName + "_VERSION_PATCH");
+    vv.push_back(projectName + "_VERSION_TWEAK");
     std::string vw;
     for (std::vector<std::string>::iterator i = vv.begin(); i != vv.end();
          ++i) {
@@ -234,7 +237,7 @@ bool cmProjectCommand::InitialPass(std::vector<std::string> const& args,
     languages.push_back("CXX");
   }
   this->Makefile->EnableLanguage(languages, false);
-  std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
+  std::string extraInclude = "CMAKE_PROJECT_" + projectName + "_INCLUDE";
   const char* include = this->Makefile->GetDefinition(extraInclude);
   if (include) {
     bool readit = this->Makefile->ReadDependentFile(include);
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 239b18d..cf90f91 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -755,7 +755,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
          fileIt != srcFiles.end(); ++fileIt) {
       cmSourceFile* sf = *fileIt;
       if (!PropertyEnabled(sf, "SKIP_AUTOGEN")) {
-        const std::string ext = sf->GetExtension();
+        std::string const& ext = sf->GetExtension();
         // Add generated file that will be scanned by moc or uic to
         // the dependencies
         if (mocEnabled || uicEnabled) {
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index 5a52927..1db8441 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -15,7 +15,7 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
     return true;
   }
 
-  const char* variable = args[0].c_str(); // VAR is always first
+  std::string const& variable = args[0]; // VAR is always first
   // get the old value
   const char* cacheValue = this->Makefile->GetDefinition(variable);
 
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 60c198a..b57f62a 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -138,7 +138,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
 
   // Set or append the property.
   cmake* cm = this->Makefile->GetCMakeInstance();
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
     value = CM_NULLPTR;
@@ -188,7 +188,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
   }
 
   // Set or append the property.
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
     value = CM_NULLPTR;
@@ -229,7 +229,7 @@ bool cmSetPropertyCommand::HandleTargetMode()
 bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
 {
   // Set or append the property.
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
     value = CM_NULLPTR;
@@ -268,7 +268,7 @@ bool cmSetPropertyCommand::HandleSourceMode()
 bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf)
 {
   // Set or append the property.
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
     value = CM_NULLPTR;
@@ -316,7 +316,7 @@ bool cmSetPropertyCommand::HandleTestMode()
 bool cmSetPropertyCommand::HandleTest(cmTest* test)
 {
   // Set or append the property.
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   if (this->Remove) {
     value = CM_NULLPTR;
@@ -383,7 +383,7 @@ bool cmSetPropertyCommand::HandleCacheMode()
 bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
 {
   // Set or append the property.
-  const char* name = this->PropertyName.c_str();
+  std::string const& name = this->PropertyName;
   const char* value = this->PropertyValue.c_str();
   cmState* state = this->Makefile->GetState();
   if (this->Remove) {
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index d6907e3..7a097ba 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -128,7 +128,7 @@ bool cmStringCommand::HandleToUpperLowerCommand(
     return false;
   }
 
-  std::string outvar = args[2];
+  std::string const& outvar = args[2];
   std::string output;
 
   if (toUpper) {
@@ -149,7 +149,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
     return false;
   }
   std::string::size_type cc;
-  std::string outvar = args[args.size() - 1];
+  std::string const& outvar = args[args.size() - 1];
   std::string output;
   for (cc = 1; cc < args.size() - 1; cc++) {
     int ch = atoi(args[cc].c_str());
@@ -212,7 +212,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args)
     this->SetError("sub-command REGEX requires a mode to be specified.");
     return false;
   }
-  std::string mode = args[1];
+  std::string const& mode = args[1];
   if (mode == "MATCH") {
     if (args.size() < 5) {
       this->SetError("sub-command REGEX, mode MATCH needs "
@@ -247,8 +247,8 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
 {
   //"STRING(REGEX MATCH <regular_expression> <output variable>
   // <input> [<input>...])\n";
-  std::string regex = args[2];
-  std::string outvar = args[3];
+  std::string const& regex = args[2];
+  std::string const& outvar = args[3];
 
   this->Makefile->ClearMatches();
   // Compile the regular expression.
@@ -288,8 +288,8 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
 {
   //"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
   // [<input>...])\n";
-  std::string regex = args[2];
-  std::string outvar = args[3];
+  std::string const& regex = args[2];
+  std::string const& outvar = args[3];
 
   this->Makefile->ClearMatches();
   // Compile the regular expression.
@@ -334,9 +334,9 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
 {
   //"STRING(REGEX REPLACE <regular_expression> <replace_expression>
   // <output variable> <input> [<input>...])\n"
-  std::string regex = args[2];
-  std::string replace = args[3];
-  std::string outvar = args[4];
+  std::string const& regex = args[2];
+  std::string const& replace = args[3];
+  std::string const& outvar = args[4];
 
   // Pull apart the replace expression to find the escaped [0-9] values.
   std::vector<RegexReplacement> replacement;
@@ -502,7 +502,7 @@ bool cmStringCommand::HandleCompareCommand(
     this->SetError("sub-command COMPARE requires a mode to be specified.");
     return false;
   }
-  std::string mode = args[1];
+  std::string const& mode = args[1];
   if ((mode == "EQUAL") || (mode == "NOTEQUAL") || (mode == "LESS") ||
       (mode == "LESS_EQUAL") || (mode == "GREATER") ||
       (mode == "GREATER_EQUAL")) {
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 9a5c1da..45fe430 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -78,7 +78,7 @@ bool cmTargetPropCommandBase::ProcessContentArgs(
   std::vector<std::string> const& args, unsigned int& argIndex, bool prepend,
   bool system)
 {
-  const std::string scope = args[argIndex];
+  std::string const& scope = args[argIndex];
 
   if (scope != "PUBLIC" && scope != "PRIVATE" && scope != "INTERFACE") {
     this->SetError("called with invalid arguments");
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 37d8bfb..eabd7ef 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -23,7 +23,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
   std::vector<std::string>::const_iterator arg = args.begin();
 
   // The first argument is the cache entry name.
-  std::string cacheEntry = *arg++;
+  std::string const& cacheEntry = *arg++;
   const char* cacheValue = this->Makefile->GetDefinition(cacheEntry);
   // If it exists already and appears up to date then we are done.  If
   // the string contains "(IntDir)" but that is not the
@@ -57,11 +57,11 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args,
 
   // The second argument is the utility's executable name, which will be
   // needed later.
-  std::string utilityName = *arg++;
+  std::string const& utilityName = *arg++;
 
   // The third argument specifies the relative directory of the source
   // of the utility.
-  std::string relativeSource = *arg++;
+  std::string const& relativeSource = *arg++;
   std::string utilitySource = this->Makefile->GetCurrentSourceDirectory();
   utilitySource = utilitySource + "/" + relativeSource;
 
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 10b0a88..06ca53c 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -17,11 +17,11 @@ bool cmVariableRequiresCommand::InitialPass(
     return false;
   }
 
-  std::string testVariable = args[0];
+  std::string const& testVariable = args[0];
   if (!this->Makefile->IsOn(testVariable)) {
     return true;
   }
-  std::string resultVariable = args[1];
+  std::string const& resultVariable = args[1];
   bool requirementsMet = true;
   std::string notSet;
   bool hasAdvanced = false;
diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx
index 90b0b28..281850e 100644
--- a/Source/cmVariableWatchCommand.cxx
+++ b/Source/cmVariableWatchCommand.cxx
@@ -106,7 +106,7 @@ bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args,
     this->SetError("must be called with at least one argument.");
     return false;
   }
-  std::string variable = args[0];
+  std::string const& variable = args[0];
   std::string command;
   if (args.size() > 1) {
     command = args[1];
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx
index f569e80..fc5fd21 100644
--- a/Source/cmWriteFileCommand.cxx
+++ b/Source/cmWriteFileCommand.cxx
@@ -21,7 +21,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args,
   std::string message;
   std::vector<std::string>::const_iterator i = args.begin();
 
-  std::string fileName = *i;
+  std::string const& fileName = *i;
   bool overwrite = true;
   i++;
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 53e9ab0..6894393 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -301,7 +301,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
 {
   bool findPackageMode = false;
   for (unsigned int i = 1; i < args.size(); ++i) {
-    std::string arg = args[i];
+    std::string const& arg = args[i];
     if (arg.find("-D", 0) == 0) {
       std::string entry = arg.substr(2);
       if (entry.empty()) {
@@ -617,7 +617,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
   bool haveToolset = false;
   bool havePlatform = false;
   for (unsigned int i = 1; i < args.size(); ++i) {
-    std::string arg = args[i];
+    std::string const& arg = args[i];
     if (arg.find("-H", 0) == 0) {
       directoriesSet = true;
       std::string path = arg.substr(2);
@@ -2146,7 +2146,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
   // process the arguments
   bool writeToStdout = true;
   for (unsigned int i = 1; i < args.size(); ++i) {
-    std::string arg = args[i];
+    std::string const& arg = args[i];
     if (arg.find("-G", 0) == 0) {
       std::string value = arg.substr(2);
       if (value.empty()) {
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index dc267e7..9f2e8b7 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -663,7 +663,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
     // Command to change directory and run a program.
     if (args[1] == "chdir" && args.size() >= 4) {
-      std::string directory = args[2];
+      std::string const& directory = args[2];
       if (!cmSystemTools::FileExists(directory.c_str())) {
         cmSystemTools::Error("Directory does not exist for chdir command: ",
                              args[2].c_str());
@@ -883,8 +883,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
     if (args[1] == "tar" && args.size() > 3) {
       const char* knownFormats[] = { "7zip", "gnutar", "pax", "paxr", "zip" };
 
-      std::string flags = args[2];
-      std::string outFile = args[3];
+      std::string const& flags = args[2];
+      std::string const& outFile = args[3];
       std::vector<std::string> files;
       std::string mtime;
       std::string format;
@@ -1077,9 +1077,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 int cmcmd::SymlinkLibrary(std::vector<std::string>& args)
 {
   int result = 0;
-  std::string realName = args[2];
-  std::string soName = args[3];
-  std::string name = args[4];
+  std::string const& realName = args[2];
+  std::string const& soName = args[3];
+  std::string const& name = args[4];
   if (soName != realName) {
     if (!cmcmd::SymlinkInternal(realName, soName)) {
       cmSystemTools::ReportLastSystemError("cmake_symlink_library");
@@ -1098,8 +1098,8 @@ int cmcmd::SymlinkLibrary(std::vector<std::string>& args)
 int cmcmd::SymlinkExecutable(std::vector<std::string>& args)
 {
   int result = 0;
-  std::string realName = args[2];
-  std::string name = args[3];
+  std::string const& realName = args[2];
+  std::string const& name = args[3];
   if (name != realName) {
     if (!cmcmd::SymlinkInternal(realName, name)) {
       cmSystemTools::ReportLastSystemError("cmake_symlink_executable");

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ee2019239751f91958a390aa3dfa24ea603f2f5
commit 1ee2019239751f91958a390aa3dfa24ea603f2f5
Author:     André Apitzsch <andre.apitzsch at etit.tu-chemnitz.de>
AuthorDate: Tue May 23 11:26:10 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 26 11:35:03 2017 -0400

    FindProtobuf: add optional export declaration macro to generated cpp files

diff --git a/Help/release/dev/FindProtobuf-export-macro.rst b/Help/release/dev/FindProtobuf-export-macro.rst
new file mode 100644
index 0000000..43d9223
--- /dev/null
+++ b/Help/release/dev/FindProtobuf-export-macro.rst
@@ -0,0 +1,6 @@
+FindProtobuf-export-macro
+-------------------------
+
+* The :module:`FindProtobuf` module :command:`protobuf_generate_cpp`
+  command gained an ``EXPORT_MACRO`` option to specify the name of
+  a DLL export markup macro.
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index abc7518..33262f3 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -76,6 +76,7 @@
 #   include_directories(${Protobuf_INCLUDE_DIRS})
 #   include_directories(${CMAKE_CURRENT_BINARY_DIR})
 #   protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS foo.proto)
+#   protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS EXPORT_MACRO DLL_EXPORT foo.proto)
 #   protobuf_generate_python(PROTO_PY foo.proto)
 #   add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS})
 #   target_link_libraries(bar ${Protobuf_LIBRARIES})
@@ -89,12 +90,15 @@
 #
 #   Add custom commands to process ``.proto`` files to C++::
 #
-#     protobuf_generate_cpp (<SRCS> <HDRS> [<ARGN>...])
+#     protobuf_generate_cpp (<SRCS> <HDRS> [EXPORT_MACRO <MACRO>] [<ARGN>...])
 #
 #   ``SRCS``
 #     Variable to define with autogenerated source files
 #   ``HDRS``
 #     Variable to define with autogenerated header files
+#   ``EXPORT_MACRO``
+#     is a macro which should expand to ``__declspec(dllexport)`` or
+#     ``__declspec(dllimport)`` depending on what is being compiled.
 #   ``ARGN``
 #     ``.proto`` files
 #
@@ -110,14 +114,21 @@
 #     ``.proto`` filess
 
 function(PROTOBUF_GENERATE_CPP SRCS HDRS)
-  if(NOT ARGN)
+  cmake_parse_arguments(protobuf "" "EXPORT_MACRO" "" ${ARGN})
+
+  set(PROTO_FILES "${protobuf_UNPARSED_ARGUMENTS}")
+  if(NOT PROTO_FILES)
     message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
     return()
   endif()
 
+  if(protobuf_EXPORT_MACRO)
+    set(DLL_EXPORT_DECL "dllexport_decl=${protobuf_EXPORT_MACRO}:")
+  endif()
+
   if(PROTOBUF_GENERATE_CPP_APPEND_PATH)
     # Create an include path for each file specified
-    foreach(FIL ${ARGN})
+    foreach(FIL ${PROTO_FILES})
       get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
       get_filename_component(ABS_PATH ${ABS_FIL} PATH)
       list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
@@ -145,7 +156,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
 
   set(${SRCS})
   set(${HDRS})
-  foreach(FIL ${ARGN})
+  foreach(FIL ${PROTO_FILES})
     get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
     get_filename_component(FIL_WE ${FIL} NAME_WE)
     if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH)
@@ -162,7 +173,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
       OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
              "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
       COMMAND  ${Protobuf_PROTOC_EXECUTABLE}
-      ARGS --cpp_out  ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+      ARGS "--cpp_out=${DLL_EXPORT_DECL}${CMAKE_CURRENT_BINARY_DIR}" ${_protobuf_include_path} ${ABS_FIL}
       DEPENDS ${ABS_FIL} ${Protobuf_PROTOC_EXECUTABLE}
       COMMENT "Running C++ protocol buffer compiler on ${FIL}"
       VERBATIM )

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc329a01258ecc7f4debbae94baf067136617c65
commit cc329a01258ecc7f4debbae94baf067136617c65
Author:     Alex Turbov <i.zaufi at gmail.com>
AuthorDate: Sun Apr 23 21:30:31 2017 +0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 26 11:21:49 2017 -0400

    FindBoost: Simplify search in lists.
    
    Instead of `list(FIND...)` and then checking result for `-1`
    (found/not-found), nowadays `if` command has the `IN_LIST` test for
    that.

diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index b2fb4b7..cc273e0 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -208,6 +208,10 @@
 #
 # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
 
+# Save project's policies
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
 #-------------------------------------------------------------------------------
 # Before we go searching, check whether boost-cmake is available, unless the
 # user specifically asked NOT to search for boost-cmake.
@@ -865,14 +869,12 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
     list(APPEND _boost_processed_components ${_boost_unprocessed_components})
     foreach(component ${_boost_unprocessed_components})
       string(TOUPPER ${component} uppercomponent)
-  set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
+      set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
       _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES)
       set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
       set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
       foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
-        list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
-        list(FIND _boost_new_components "${componentdep}" _boost_component_new)
-        if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
+        if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components))
           list(APPEND _boost_new_components ${componentdep})
         endif()
       endforeach()
@@ -1499,8 +1501,7 @@ endif()
 _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
 
 # If thread is required, get the thread libs as a dependency
-list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS)
-if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
+if("thread" IN_LIST Boost_FIND_COMPONENTS)
   include(CMakeFindDependencyMacro)
   find_dependency(Threads)
 endif()
@@ -1925,3 +1926,6 @@ list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
 list(SORT _Boost_COMPONENTS_SEARCHED)
 set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
   CACHE INTERNAL "Components requested for this build tree.")
+
+# Restore project's policies
+cmake_policy(POP)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3e692caeaae920a920aebebdd229f4d5ddf0af8
commit e3e692caeaae920a920aebebdd229f4d5ddf0af8
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri May 26 15:08:37 2017 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Fri May 26 15:27:17 2017 +0200

    Autogen: Test adaptions

diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt
index f57c6e7..3ea1294 100644
--- a/Tests/QtAutoUicInterface/CMakeLists.txt
+++ b/Tests/QtAutoUicInterface/CMakeLists.txt
@@ -53,6 +53,12 @@ set_property(TARGET KI18n APPEND PROPERTY
 
 # END upstream
 
+if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+set(INC_DIR "include_${CMAKE_BUILD_TYPE}" )
+else()
+set(INC_DIR "include" )
+endif()
+
 add_library(LibWidget libwidget.cpp)
 target_link_libraries(LibWidget KI18n ${QT_GUI_TARGET})
 set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON)
@@ -64,6 +70,6 @@ target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET})
 add_executable(QtAutoUicInterface main.cpp)
 target_compile_definitions(QtAutoUicInterface
   PRIVATE
-    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/include_${CMAKE_BUILD_TYPE}/ui_libwidget.h"
-    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/include_${CMAKE_BUILD_TYPE}/ui_mywidget.h"
+    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/${INC_DIR}/ui_libwidget.h"
+    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/${INC_DIR}/ui_mywidget.h"
 )

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbda590628868e37956838c1d93d54050ab3e7c1
commit dbda590628868e37956838c1d93d54050ab3e7c1
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon May 15 11:05:58 2017 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Fri May 26 15:27:17 2017 +0200

    Autogen: Per-config file suffixes. New AUTOGEN_BUILD_DIR target property.
    
    Closes #14760
    Closes #14313

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 38cc0d8..ec25596 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -119,6 +119,7 @@ Properties on Targets
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
    /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
    /prop_tgt/ARCHIVE_OUTPUT_NAME
+   /prop_tgt/AUTOGEN_BUILD_DIR
    /prop_tgt/AUTOGEN_TARGET_DEPENDS
    /prop_tgt/AUTOMOC_DEPEND_FILTERS
    /prop_tgt/AUTOMOC_MOC_OPTIONS
diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst
index 3b95b05..9f3968c 100644
--- a/Help/manual/cmake-qt.7.rst
+++ b/Help/manual/cmake-qt.7.rst
@@ -68,14 +68,24 @@ be included by the user in the C++ implementation file with a preprocessor
 ``#include``.
 
 Included ``moc_*.cpp`` and ``*.moc`` files will be generated in the
-``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
+``<AUTOGEN_BUILD_DIR>/include`` directory which is
 automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
 (This differs from CMake 3.7 and below; see their documentation for details.)
 
+* For multi configuration generators, except Xcode, the include directory is
+  ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+
+* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
+
 Not included ``moc_<basename>.cpp`` files will be generated in custom
 folders to avoid name collisions and included in a separate
-``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/moc_compilation.cpp``
-file which is compiled into the target.
+``<AUTOGEN_BUILD_DIR>/mocs_compilation.cpp`` file which is compiled
+into the target.
+
+* For multi configuration generators, except Xcode, the file is
+  ``<AUTOGEN_BUILD_DIR>/mocs_compilation_<CONFIG>.cpp``.
+
+* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
 
 The ``moc`` command line will consume the :prop_tgt:`COMPILE_DEFINITIONS` and
 :prop_tgt:`INCLUDE_DIRECTORIES` target properties from the target it is being
@@ -109,10 +119,15 @@ searched for first in the vicinity of including file and afterwards in the
 optional :prop_tgt:`AUTOUIC_SEARCH_PATHS` of the target.
 
 The generated generated ``ui_*.h`` files are placed in the
-``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
+``<AUTOGEN_BUILD_DIR>/include`` directory which is
 automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
 (This differs from CMake 3.7 and below; see their documentation for details.)
 
+* For multi configuration generators, except Xcode, the include directory is
+  ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+
+* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
+
 The :prop_tgt:`AUTOUIC` target property may be pre-set for all following
 targets by setting the :variable:`CMAKE_AUTOUIC` variable.  The
 :prop_tgt:`AUTOUIC_OPTIONS` target property may be populated to set options
diff --git a/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst b/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst
new file mode 100644
index 0000000..8db6ede
--- /dev/null
+++ b/Help/prop_tgt/AUTOGEN_BUILD_DIR.rst
@@ -0,0 +1,17 @@
+AUTOGEN_BUILD_DIR
+-----------------
+
+Directory where :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and :prop_tgt:`AUTORCC`
+generate files for the target.
+
+The directory is created on demand and automatically added to the
+:prop_dir:`ADDITIONAL_MAKE_CLEAN_FILES`.
+
+When unset or empty the directory ``<dir>/<target-name>_autogen`` is used where
+``<dir>`` is :variable:`CMAKE_CURRENT_BINARY_DIR` and ``<target-name>``
+is :prop_tgt:`NAME`.
+
+By default :prop_tgt:`AUTOGEN_BUILD_DIR` is unset.
+
+See the :manual:`cmake-qt(7)` manual for more information on using CMake
+with Qt.
diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst
index 7e10fde..81eff82 100644
--- a/Help/prop_tgt/AUTOMOC.rst
+++ b/Help/prop_tgt/AUTOMOC.rst
@@ -13,13 +13,17 @@ source files at build time and invoke moc accordingly.
 
 * If an ``#include`` statement like ``#include "moc_<basename>.cpp"`` is found,
   the ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in an otherwise empty
-  line of the ``<basename>.h(xx)`` header file. ``moc`` is run on the header file to
-  generate ``moc_<basename>.cpp`` in the
-  ``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory
-  which is automatically added to the target's
-  :prop_tgt:`INCLUDE_DIRECTORIES`.  This allows the compiler to find the
-  included ``moc_<basename>.cpp`` file regardless of the location the
-  original source.
+  line of the ``<basename>.h(xx)`` header file. ``moc`` is run on the header
+  file to generate ``moc_<basename>.cpp`` in the
+  ``<AUTOGEN_BUILD_DIR>/include`` directory which is automatically added
+  to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+  This allows the compiler to find the included ``moc_<basename>.cpp`` file
+  regardless of the location the original source.
+
+  * For multi configuration generators, except Xcode, the include directory is
+    ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+
+  * See :prop_tgt:`AUTOGEN_BUILD_DIR`.
 
 * If an ``#include`` statement like ``#include "<basename>.moc"`` is found,
   then ``Q_OBJECT`` or ``Q_GADGET`` macros are expected in the current source
@@ -28,10 +32,19 @@ source files at build time and invoke moc accordingly.
 * Header files that are not included by an ``#include "moc_<basename>.cpp"``
   statement are nonetheless scanned for ``Q_OBJECT`` or ``Q_GADGET`` macros.
   The resulting ``moc_<basename>.cpp`` files are generated in custom
-  directories and automatically included in the generated
-  ``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/moc_compilation.cpp`` file,
-  which is compiled as part of the target. The custom directories help to
-  avoid name collisions for moc files with the same ``<basename>``.
+  directories and automatically included in a generated
+  ``<AUTOGEN_BUILD_DIR>/mocs_compilation.cpp`` file,
+  which is compiled as part of the target.
+
+  * For multi configuration generators, except Xcode, the file names are
+    ``moc_<basename>_<CONFIG>.cpp`` and
+    ``<AUTOGEN_BUILD_DIR>/mocs_compilation_<CONFIG>.cpp``.
+
+  * The custom directories with checksum
+    based names help to avoid name collisions for moc files with the same
+    ``<basename>``.
+
+  * See :prop_tgt:`AUTOGEN_BUILD_DIR`.
 
 * Additionally, header files with the same base name as a source file,
   (like ``<basename>.h``) or ``_p`` appended to the base name (like
diff --git a/Help/prop_tgt/AUTOUIC.rst b/Help/prop_tgt/AUTOUIC.rst
index 91d95e5..4a08072 100644
--- a/Help/prop_tgt/AUTOUIC.rst
+++ b/Help/prop_tgt/AUTOUIC.rst
@@ -14,8 +14,13 @@ and invoke ``uic`` accordingly.  If an ``#include`` statement like
 searched for first in the vicinity of ``source.cpp`` and afterwards in the
 optional :prop_tgt:`AUTOUIC_SEARCH_PATHS` of the target.
 ``uic`` is run on the ``foo.ui`` file to generate ``ui_foo.h`` in the directory
-``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include``,
-which is added to the target's :prop_tgt:`INCLUDE_DIRECTORIES` automatically.
+``<AUTOGEN_BUILD_DIR>/include``,
+which is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+
+* For multi configuration generators, except Xcode, the include directory is
+  ``<AUTOGEN_BUILD_DIR>/include_<CONFIG>``.
+
+* See :prop_tgt:`AUTOGEN_BUILD_DIR`.
 
 This property is initialized by the value of the :variable:`CMAKE_AUTOUIC`
 variable if it is set when a target is created.
diff --git a/Help/release/dev/Autogen_build_dir.rst b/Help/release/dev/Autogen_build_dir.rst
new file mode 100644
index 0000000..d11c00b
--- /dev/null
+++ b/Help/release/dev/Autogen_build_dir.rst
@@ -0,0 +1,6 @@
+AutoGen build dir
+-----------------
+
+* The new target property :prop_tgt:`AUTOGEN_BUILD_DIR` was introduced which
+  allows to set a custom output directory for
+  :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTOUIC` and :prop_tgt:`AUTORCC`.
diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 9b4941c..4e85474 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -1,6 +1,3 @@
-# Target names
-set(AM_TARGET_NAME @_autogen_target_name@)
-set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
 # Directories and files
 set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
 set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index bc5095d..6b85c66 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -7,6 +7,7 @@
 #include "cmCustomCommandLines.h"
 #include "cmFilePathChecksum.h"
 #include "cmGeneratorTarget.h"
+#include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmOutputConverter.h"
@@ -73,10 +74,13 @@ static std::string GetAutogenTargetFilesDir(cmGeneratorTarget const* target)
 
 static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
 {
-  cmMakefile* makefile = target->Target->GetMakefile();
-  std::string targetDir = makefile->GetCurrentBinaryDirectory();
-  targetDir += "/";
-  targetDir += GetAutogenTargetName(target);
+  std::string targetDir = GetSafeProperty(target, "AUTOGEN_BUILD_DIR");
+  if (targetDir.empty()) {
+    cmMakefile* makefile = target->Target->GetMakefile();
+    targetDir = makefile->GetCurrentBinaryDirectory();
+    targetDir += "/";
+    targetDir += GetAutogenTargetName(target);
+  }
   return targetDir;
 }
 
@@ -150,6 +154,50 @@ static void GetCompileDefinitionsAndDirectories(
   }
 }
 
+static bool IsMultiConfig(cmGlobalGenerator* globalGen)
+{
+  // FIXME: Xcode does not support per-config sources, yet.
+  //        (EXCLUDED_SOURCE_FILE_NAMES)
+  //        Treat it as a single configuration generator meanwhile.
+  if (globalGen->GetName().find("Xcode") != std::string::npos) {
+    return false;
+  }
+  return globalGen->IsMultiConfig();
+}
+
+static std::vector<std::string> GetConfigurations(
+  cmMakefile* makefile, std::string* config = CM_NULLPTR)
+{
+  std::vector<std::string> configs;
+  {
+    std::string cfg = makefile->GetConfigurations(configs);
+    if (config != CM_NULLPTR) {
+      *config = cfg;
+    }
+  }
+  // Add empty configuration on demand
+  if (configs.empty()) {
+    configs.push_back("");
+  }
+  return configs;
+}
+
+static std::vector<std::string> GetConfigurationSuffixes(cmMakefile* makefile)
+{
+  std::vector<std::string> suffixes;
+  if (IsMultiConfig(makefile->GetGlobalGenerator())) {
+    makefile->GetConfigurations(suffixes);
+    for (std::vector<std::string>::iterator it = suffixes.begin();
+         it != suffixes.end(); ++it) {
+      it->insert(0, "_");
+    }
+  }
+  if (suffixes.empty()) {
+    suffixes.push_back("");
+  }
+  return suffixes;
+}
+
 static void AddDefinitionEscaped(cmMakefile* makefile, const char* key,
                                  const std::string& value)
 {
@@ -219,6 +267,17 @@ static bool AddToSourceGroup(cmMakefile* makefile, const std::string& fileName,
   return true;
 }
 
+static void AddGeneratedSource(cmMakefile* makefile,
+                               const std::string& filename,
+                               cmQtAutoGeneratorCommon::GeneratorType genType)
+{
+  cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
+  gFile->SetProperty("GENERATED", "1");
+  gFile->SetProperty("SKIP_AUTOGEN", "On");
+
+  AddToSourceGroup(makefile, filename, genType);
+}
+
 static void AcquireScanFiles(cmGeneratorTarget const* target,
                              std::vector<std::string>& mocUicSources,
                              std::vector<std::string>& mocUicHeaders,
@@ -275,10 +334,11 @@ static void AcquireScanFiles(cmGeneratorTarget const* target,
 
 static void MocSetupAutoTarget(
   cmGeneratorTarget const* target, const std::string& autogenTargetName,
-  const std::string& qtMajorVersion,
+  std::string const& qtMajorVersion, std::string const& config,
+  std::vector<std::string> const& configs,
   std::vector<std::string> const& mocSkipList,
-  std::map<std::string, std::string>& configIncludes,
-  std::map<std::string, std::string>& configDefines)
+  std::map<std::string, std::string>& configMocIncludes,
+  std::map<std::string, std::string>& configMocDefines)
 {
   cmLocalGenerator* lg = target->GetLocalGenerator();
   cmMakefile* makefile = target->Target->GetMakefile();
@@ -300,35 +360,26 @@ static void MocSetupAutoTarget(
   }
   // Moc includes and compile definitions
   {
-    std::string _moc_incs;
-    std::string _moc_compile_defs;
-    std::vector<std::string> configs;
-    {
-      const std::string& config = makefile->GetConfigurations(configs);
-      GetCompileDefinitionsAndDirectories(target, config, _moc_incs,
-                                          _moc_compile_defs);
-      AddDefinitionEscaped(makefile, "_moc_incs", _moc_incs);
-      AddDefinitionEscaped(makefile, "_moc_compile_defs", _moc_compile_defs);
-    }
+    // Default settings
+    std::string incs;
+    std::string compileDefs;
+    GetCompileDefinitionsAndDirectories(target, config, incs, compileDefs);
+    AddDefinitionEscaped(makefile, "_moc_incs", incs);
+    AddDefinitionEscaped(makefile, "_moc_compile_defs", compileDefs);
+
+    // Configuration specific settings
     for (std::vector<std::string>::const_iterator li = configs.begin();
          li != configs.end(); ++li) {
-      std::string config_moc_incs;
-      std::string config_moc_compile_defs;
-      GetCompileDefinitionsAndDirectories(target, *li, config_moc_incs,
-                                          config_moc_compile_defs);
-      if (config_moc_incs != _moc_incs) {
-        configIncludes[*li] =
-          cmOutputConverter::EscapeForCMake(config_moc_incs);
-        if (_moc_incs.empty()) {
-          _moc_incs = config_moc_incs;
-        }
+      std::string configIncs;
+      std::string configCompileDefs;
+      GetCompileDefinitionsAndDirectories(target, *li, configIncs,
+                                          configCompileDefs);
+      if (configIncs != incs) {
+        configMocIncludes[*li] = cmOutputConverter::EscapeForCMake(configIncs);
       }
-      if (config_moc_compile_defs != _moc_compile_defs) {
-        configDefines[*li] =
-          cmOutputConverter::EscapeForCMake(config_moc_compile_defs);
-        if (_moc_compile_defs.empty()) {
-          _moc_compile_defs = config_moc_compile_defs;
-        }
+      if (configCompileDefs != compileDefs) {
+        configMocDefines[*li] =
+          cmOutputConverter::EscapeForCMake(configCompileDefs);
       }
     }
   }
@@ -374,7 +425,8 @@ static void UicGetOpts(cmGeneratorTarget const* target,
 }
 
 static void UicSetupAutoTarget(
-  cmGeneratorTarget const* target, const std::string& qtMajorVersion,
+  cmGeneratorTarget const* target, std::string const& qtMajorVersion,
+  std::string const& config, std::vector<std::string> const& configs,
   std::vector<std::string> const& uicSkipList,
   std::map<std::string, std::string>& configUicOptions)
 {
@@ -395,25 +447,21 @@ static void UicSetupAutoTarget(
     }
     AddDefinitionEscaped(makefile, "_uic_search_paths", uicSearchPaths);
   }
-
   // Uic target options
   {
-    std::string _uic_opts;
-    std::vector<std::string> configs;
-    UicGetOpts(target, makefile->GetConfigurations(configs), _uic_opts);
-
-    AddDefinitionEscaped(makefile, "_uic_target_options", _uic_opts);
+    // Default settings
+    std::string uicOpts;
+    UicGetOpts(target, config, uicOpts);
+    AddDefinitionEscaped(makefile, "_uic_target_options", uicOpts);
 
+    // Configuration specific settings
     for (std::vector<std::string>::const_iterator li = configs.begin();
          li != configs.end(); ++li) {
-      std::string config_uic_opts;
-      UicGetOpts(target, *li, config_uic_opts);
-      if (config_uic_opts != _uic_opts) {
+      std::string configUicOpts;
+      UicGetOpts(target, *li, configUicOpts);
+      if (configUicOpts != uicOpts) {
         configUicOptions[*li] =
-          cmOutputConverter::EscapeForCMake(config_uic_opts);
-        if (_uic_opts.empty()) {
-          _uic_opts = config_uic_opts;
-        }
+          cmOutputConverter::EscapeForCMake(configUicOpts);
       }
     }
   }
@@ -622,14 +670,24 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
 {
   if (target->GetPropertyAsBool("AUTOMOC")) {
     cmMakefile* makefile = target->Target->GetMakefile();
-    std::string mocCppFile = GetAutogenTargetBuildDir(target);
-    mocCppFile += "/moc_compilation.cpp";
-    {
-      cmSourceFile* gFile = makefile->GetOrCreateSource(mocCppFile, true);
-      gFile->SetProperty("SKIP_AUTOGEN", "On");
+    const std::vector<std::string> suffixes =
+      GetConfigurationSuffixes(makefile);
+    // Get build directory
+    const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
+    // Register all compilation files as generated
+    for (std::vector<std::string>::const_iterator it = suffixes.begin();
+         it != suffixes.end(); ++it) {
+      std::string mcFile = autogenBuildDir + "/mocs_compilation";
+      mcFile += *it;
+      mcFile += ".cpp";
+      AddGeneratedSource(makefile, mcFile, cmQtAutoGeneratorCommon::MOC);
+    }
+    // Mocs compilation file
+    if (IsMultiConfig(target->GetGlobalGenerator())) {
+      target->AddSource(autogenBuildDir + "/mocs_compilation_$<CONFIG>.cpp");
+    } else {
+      target->AddSource(autogenBuildDir + "/mocs_compilation.cpp");
     }
-    target->AddSource(mocCppFile);
-    AddToSourceGroup(makefile, mocCppFile, cmQtAutoGeneratorCommon::MOC);
   }
 }
 
@@ -642,21 +700,30 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC");
   const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC");
   const bool rccEnabled = target->GetPropertyAsBool("AUTORCC");
+  const bool multiConfig = IsMultiConfig(target->GetGlobalGenerator());
   const std::string autogenTargetName = GetAutogenTargetName(target);
   const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
   const std::string workingDirectory =
     cmSystemTools::CollapseFullPath("", makefile->GetCurrentBinaryDirectory());
   const std::string qtMajorVersion = GetQtMajorVersion(target);
   const std::string rccCommand = RccGetExecutable(target, qtMajorVersion);
+  const std::vector<std::string> suffixes = GetConfigurationSuffixes(makefile);
   std::vector<std::string> autogenDepends;
   std::vector<std::string> autogenProvides;
 
+  // Remove build directories on cleanup
+  makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+                           autogenBuildDir.c_str(), false);
+
   // Remove old settings on cleanup
   {
-    std::string fname = GetAutogenTargetFilesDir(target);
-    fname += "/AutogenOldSettings.cmake";
-    makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fname.c_str(),
-                             false);
+    std::string base = GetAutogenTargetFilesDir(target);
+    for (std::vector<std::string>::const_iterator it = suffixes.begin();
+         it != suffixes.end(); ++it) {
+      std::string fname = base + "/AutogenOldSettings" + *it + ".cmake";
+      makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fname.c_str(),
+                               false);
+    }
   }
 
   // Compose command lines
@@ -697,22 +764,26 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
     autogenComment = "Automatic " + tools + " for target " + target->GetName();
   }
 
-  // Create autogen target build directory and add it to the clean files
-  cmSystemTools::MakeDirectory(autogenBuildDir);
-  makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
-                           autogenBuildDir.c_str(), false);
+  // Add moc compilation to generated files list
+  if (mocEnabled) {
+    for (std::vector<std::string>::const_iterator it = suffixes.begin();
+         it != suffixes.end(); ++it) {
+      std::string mcFile = autogenBuildDir + "/mocs_compilation";
+      mcFile += *it;
+      mcFile += ".cpp";
+      autogenProvides.push_back(mcFile);
+    }
+  }
 
-  // Create autogen target includes directory and
-  // add it to the origin target INCLUDE_DIRECTORIES
+  // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES
   if (mocEnabled || uicEnabled) {
-    const std::string incsDir = autogenBuildDir + "/include";
-    cmSystemTools::MakeDirectory(incsDir);
-    target->AddIncludeDirectory(incsDir, true);
-  }
+    if (multiConfig) {
+      target->AddIncludeDirectory(autogenBuildDir + "/include_$<CONFIG>",
+                                  true);
 
-  // Register moc compilation file as generated
-  if (mocEnabled) {
-    autogenProvides.push_back(autogenBuildDir + "/moc_compilation.cpp");
+    } else {
+      target->AddIncludeDirectory(autogenBuildDir + "/include", true);
+    }
   }
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -783,24 +854,29 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
           // Compose rcc output file name
           {
-            std::string rccOut = autogenBuildDir;
-            rccOut += "/";
-            rccOut += fpathCheckSum.getPart(absFile);
-            rccOut += "/qrc_";
-            rccOut +=
+            std::string rccOutBase = autogenBuildDir + "/";
+            rccOutBase += fpathCheckSum.getPart(absFile);
+            rccOutBase += "/qrc_";
+            rccOutBase +=
               cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
-            rccOut += ".cpp";
-
-            // Register rcc output file as generated
-            autogenProvides.push_back(rccOut);
 
+            // Register rcc ouput file as generated
+            for (std::vector<std::string>::const_iterator it =
+                   suffixes.begin();
+                 it != suffixes.end(); ++it) {
+              std::string rccOutCfg = rccOutBase;
+              rccOutCfg += *it;
+              rccOutCfg += ".cpp";
+              AddGeneratedSource(makefile, rccOutCfg,
+                                 cmQtAutoGeneratorCommon::RCC);
+              autogenProvides.push_back(rccOutCfg);
+            }
             // Add rcc output file to origin target sources
-            {
-              cmSourceFile* gFile = makefile->GetOrCreateSource(rccOut, true);
-              gFile->SetProperty("SKIP_AUTOGEN", "On");
+            if (multiConfig) {
+              target->AddSource(rccOutBase + "_$<CONFIG>.cpp");
+            } else {
+              target->AddSource(rccOutBase + ".cpp");
             }
-            target->AddSource(rccOut);
-            AddToSourceGroup(makefile, rccOut, cmQtAutoGeneratorCommon::RCC);
           }
 
           if (PropertyEnabled(sf, "GENERATED")) {
@@ -889,9 +965,25 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
   cmMakefile::ScopePushPop varScope(makefile);
   static_cast<void>(varScope);
 
+  // Get configurations
+  std::string config;
+  const std::vector<std::string> configs(GetConfigurations(makefile, &config));
+
+  // Configurations settings buffers
+  std::map<std::string, std::string> configSuffix;
   std::map<std::string, std::string> configMocIncludes;
   std::map<std::string, std::string> configMocDefines;
   std::map<std::string, std::string> configUicOptions;
+
+  // Configuration suffix
+  if (IsMultiConfig(target->GetGlobalGenerator())) {
+    for (std::vector<std::string>::const_iterator it = configs.begin();
+         it != configs.end(); ++it) {
+      configSuffix[*it] = "_" + *it;
+    }
+  }
+
+  // Basic setup
   {
     const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC");
     const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC");
@@ -899,20 +991,21 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
     const std::string autogenTargetName = GetAutogenTargetName(target);
     const std::string qtMajorVersion = GetQtMajorVersion(target);
 
-    std::vector<std::string> _sources;
-    std::vector<std::string> _headers;
+    std::vector<std::string> sources;
+    std::vector<std::string> headers;
 
     if (mocEnabled || uicEnabled || rccEnabled) {
       std::vector<std::string> mocSkipList;
       std::vector<std::string> uicSkipList;
-      AcquireScanFiles(target, _sources, _headers, mocSkipList, uicSkipList);
+      AcquireScanFiles(target, sources, headers, mocSkipList, uicSkipList);
       if (mocEnabled) {
-        MocSetupAutoTarget(target, autogenTargetName, qtMajorVersion,
-                           mocSkipList, configMocIncludes, configMocDefines);
+        MocSetupAutoTarget(target, autogenTargetName, qtMajorVersion, config,
+                           configs, mocSkipList, configMocIncludes,
+                           configMocDefines);
       }
       if (uicEnabled) {
-        UicSetupAutoTarget(target, qtMajorVersion, uicSkipList,
-                           configUicOptions);
+        UicSetupAutoTarget(target, qtMajorVersion, config, configs,
+                           uicSkipList, configUicOptions);
       }
       if (rccEnabled) {
         RccSetupAutoTarget(target, qtMajorVersion);
@@ -921,25 +1014,23 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
 
     AddDefinitionEscaped(makefile, "_autogen_build_dir",
                          GetAutogenTargetBuildDir(target));
-    AddDefinitionEscaped(makefile, "_autogen_target_name", autogenTargetName);
-    AddDefinitionEscaped(makefile, "_origin_target_name", target->GetName());
     AddDefinitionEscaped(makefile, "_qt_version_major", qtMajorVersion);
-    AddDefinitionEscaped(makefile, "_sources", _sources);
-    AddDefinitionEscaped(makefile, "_headers", _headers);
+    AddDefinitionEscaped(makefile, "_sources", sources);
+    AddDefinitionEscaped(makefile, "_headers", headers);
   }
 
-  // Generate config file
-  std::string inputFile = cmSystemTools::GetCMakeRoot();
-  inputFile += "/Modules/AutogenInfo.cmake.in";
-  std::string outputFile = GetAutogenTargetFilesDir(target);
-  outputFile += "/AutogenInfo.cmake";
-
-  makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true,
-                          false);
+  // Generate info file
+  std::string infoFile = GetAutogenTargetFilesDir(target);
+  infoFile += "/AutogenInfo.cmake";
+  {
+    std::string inf = cmSystemTools::GetCMakeRoot();
+    inf += "/Modules/AutogenInfo.cmake.in";
+    makefile->ConfigureFile(inf.c_str(), infoFile.c_str(), false, true, false);
+  }
 
-  // Append custom config definitions to info file
-  if (!configMocDefines.empty() || !configMocIncludes.empty() ||
-      !configUicOptions.empty()) {
+  // Append custom definitions to info file on demand
+  if (!configSuffix.empty() || !configMocDefines.empty() ||
+      !configMocIncludes.empty() || !configUicOptions.empty()) {
 
     // Ensure we have write permission in case .in was read-only.
     mode_t perm = 0;
@@ -948,46 +1039,49 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
 #else
     mode_t mode_write = S_IWUSR;
 #endif
-    cmSystemTools::GetPermissions(outputFile, perm);
+    cmSystemTools::GetPermissions(infoFile, perm);
     if (!(perm & mode_write)) {
-      cmSystemTools::SetPermissions(outputFile, perm | mode_write);
+      cmSystemTools::SetPermissions(infoFile, perm | mode_write);
     }
 
-    cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
-    if (!infoFile) {
-      std::string error = "Internal CMake error when trying to open file: ";
-      error += outputFile;
-      error += " for writing.";
-      cmSystemTools::Error(error.c_str());
-    } else {
-      infoFile << "# Configuration specific options\n";
-      if (!configMocDefines.empty()) {
-        for (std::map<std::string, std::string>::iterator
-               it = configMocDefines.begin(),
-               end = configMocDefines.end();
-             it != end; ++it) {
-          infoFile << "set(AM_MOC_DEFINITIONS_" << it->first << " "
-                   << it->second << ")\n";
-        }
+    // Open and write file
+    cmsys::ofstream ofs(infoFile.c_str(), std::ios::app);
+    if (ofs) {
+      ofs << "# Configuration specific options\n";
+      for (std::map<std::string, std::string>::iterator
+             it = configSuffix.begin(),
+             end = configSuffix.end();
+           it != end; ++it) {
+        ofs << "set(AM_CONFIG_SUFFIX_" << it->first << " " << it->second
+            << ")\n";
       }
-      if (!configMocIncludes.empty()) {
-        for (std::map<std::string, std::string>::iterator
-               it = configMocIncludes.begin(),
-               end = configMocIncludes.end();
-             it != end; ++it) {
-          infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second
-                   << ")\n";
-        }
+      for (std::map<std::string, std::string>::iterator
+             it = configMocDefines.begin(),
+             end = configMocDefines.end();
+           it != end; ++it) {
+        ofs << "set(AM_MOC_DEFINITIONS_" << it->first << " " << it->second
+            << ")\n";
       }
-      if (!configUicOptions.empty()) {
-        for (std::map<std::string, std::string>::iterator
-               it = configUicOptions.begin(),
-               end = configUicOptions.end();
-             it != end; ++it) {
-          infoFile << "set(AM_UIC_TARGET_OPTIONS_" << it->first << " "
-                   << it->second << ")\n";
-        }
+      for (std::map<std::string, std::string>::iterator
+             it = configMocIncludes.begin(),
+             end = configMocIncludes.end();
+           it != end; ++it) {
+        ofs << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second
+            << ")\n";
+      }
+      for (std::map<std::string, std::string>::iterator
+             it = configUicOptions.begin(),
+             end = configUicOptions.end();
+           it != end; ++it) {
+        ofs << "set(AM_UIC_TARGET_OPTIONS_" << it->first << " " << it->second
+            << ")\n";
       }
+    } else {
+      // File open error
+      std::string error = "Internal CMake error when trying to open file: ";
+      error += cmQtAutoGeneratorCommon::Quoted(infoFile);
+      error += " for writing.";
+      cmSystemTools::Error(error.c_str());
     }
   }
 }
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 19ae47a..27e4928 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -78,8 +78,8 @@ static void InfoGet(cmMakefile* makefile, const char* key,
   cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
 }
 
-static void InfoGet(cmMakefile* makefile, const char* key,
-                    const std::string& config, std::vector<std::string>& list)
+static void InfoGetConfig(cmMakefile* makefile, const char* key,
+                          const std::string& config, std::string& value)
 {
   const char* valueConf = CM_NULLPTR;
   {
@@ -93,7 +93,16 @@ static void InfoGet(cmMakefile* makefile, const char* key,
   if (valueConf == CM_NULLPTR) {
     valueConf = makefile->GetSafeDefinition(key);
   }
-  cmSystemTools::ExpandListArgument(valueConf, list);
+  value = valueConf;
+}
+
+static void InfoGetConfig(cmMakefile* makefile, const char* key,
+                          const std::string& config,
+                          std::vector<std::string>& list)
+{
+  std::string value;
+  InfoGetConfig(makefile, key, config, value);
+  cmSystemTools::ExpandListArgument(value, list);
 }
 
 inline static bool SettingsMatch(cmMakefile* makefile, const char* key,
@@ -270,6 +279,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
     }
   }
 
+  // Moc macro filters
   this->MocMacroFilters[0].first = "Q_OBJECT";
   this->MocMacroFilters[0].second.compile("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]");
   this->MocMacroFilters[1].first = "Q_GADGET";
@@ -358,12 +368,13 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   {
     this->SettingsFile = cmSystemTools::CollapseFullPath(targetDirectory);
     cmSystemTools::ConvertToUnixSlashes(this->SettingsFile);
-    this->SettingsFile += "/AutogenOldSettings.cmake";
+    this->SettingsFile += "/AutogenOldSettings";
+    this->SettingsFile += this->ConfigSuffix;
+    this->SettingsFile += ".cmake";
   }
 
-  // - Target names
-  InfoGet(makefile, "AM_TARGET_NAME", this->AutogenTargetName);
-  InfoGet(makefile, "AM_ORIGIN_TARGET_NAME", this->OriginTargetName);
+  // -- Meta
+  InfoGetConfig(makefile, "AM_CONFIG_SUFFIX", config, this->ConfigSuffix);
 
   // - Files and directories
   InfoGet(makefile, "AM_CMAKE_SOURCE_DIR", this->ProjectSourceDir);
@@ -373,6 +384,10 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   InfoGet(makefile, "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
           this->IncludeProjectDirsBefore);
   InfoGet(makefile, "AM_BUILD_DIR", this->AutogenBuildDir);
+  if (this->AutogenBuildDir.empty()) {
+    this->LogError("AutoGen: Error: Missing autogen build directory ");
+    return false;
+  }
   InfoGet(makefile, "AM_SOURCES", this->Sources);
   InfoGet(makefile, "AM_HEADERS", this->Headers);
 
@@ -396,7 +411,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   // - Moc
   if (this->MocEnabled()) {
     InfoGet(makefile, "AM_MOC_SKIP", this->MocSkipList);
-    InfoGet(makefile, "AM_MOC_DEFINITIONS", config, this->MocDefinitions);
+    InfoGetConfig(makefile, "AM_MOC_DEFINITIONS", config,
+                  this->MocDefinitions);
 #ifdef _WIN32
     {
       const std::string win32("WIN32");
@@ -405,7 +421,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
       }
     }
 #endif
-    InfoGet(makefile, "AM_MOC_INCLUDES", config, this->MocIncludePaths);
+    InfoGetConfig(makefile, "AM_MOC_INCLUDES", config, this->MocIncludePaths);
     InfoGet(makefile, "AM_MOC_OPTIONS", this->MocOptions);
     InfoGet(makefile, "AM_MOC_RELAXED_MODE", this->MocRelaxedMode);
     {
@@ -440,7 +456,8 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   if (this->UicEnabled()) {
     InfoGet(makefile, "AM_UIC_SKIP", this->UicSkipList);
     InfoGet(makefile, "AM_UIC_SEARCH_PATHS", this->UicSearchPaths);
-    InfoGet(makefile, "AM_UIC_TARGET_OPTIONS", config, this->UicTargetOptions);
+    InfoGetConfig(makefile, "AM_UIC_TARGET_OPTIONS", config,
+                  this->UicTargetOptions);
     {
       std::vector<std::string> uicFilesVec;
       std::vector<std::string> uicOptionsVec;
@@ -616,9 +633,17 @@ bool cmQtAutoGenerators::SettingsFileWrite()
 
 void cmQtAutoGenerators::Init(cmMakefile* makefile)
 {
-  this->MocCppFilenameRel = "moc_compilation.cpp";
-  this->MocCppFilenameAbs = cmSystemTools::CollapseCombinedPath(
-    this->AutogenBuildDir, this->MocCppFilenameRel);
+  // Mocs compilation file
+  this->MocCompFileRel = "mocs_compilation";
+  this->MocCompFileRel += this->ConfigSuffix;
+  this->MocCompFileRel += ".cpp";
+  this->MocCompFileAbs = cmSystemTools::CollapseCombinedPath(
+    this->AutogenBuildDir, this->MocCompFileRel);
+
+  // Mocs include directory
+  this->AutogenIncludeDir = "include";
+  this->AutogenIncludeDir += this->ConfigSuffix;
+  this->AutogenIncludeDir += "/";
 
   // Moc predefs file
   if (!this->MocPredefsCmd.empty()) {
@@ -697,10 +722,10 @@ bool cmQtAutoGenerators::RunAutogen()
   // the program goes through all .cpp files to see which moc files are
   // included. It is not really interesting how the moc file is named, but
   // what file the moc is created from. Once a moc is included the same moc
-  // may not be included in the moc_compilation.cpp file anymore. OTOH if
-  // there's a header containing Q_OBJECT where no corresponding moc file
-  // is included anywhere a moc_<filename>.cpp file is created and included
-  // in the moc_compilation.cpp file.
+  // may not be included in the mocs_compilation_$<CONFIG>.cpp file anymore.
+  // OTOH if there's a header containing Q_OBJECT where no corresponding
+  // moc file is included anywhere a moc_<filename>.cpp file is created and
+  // included in the mocs_compilation_$<CONFIG>.cpp file.
 
   // key = moc source filepath, value = moc output filepath
   std::map<std::string, std::string> mocsIncluded;
@@ -1105,7 +1130,7 @@ void cmQtAutoGenerators::MocParseHeaderContent(
   if (this->MocRequired(contentText)) {
     // Register moc job
     mocsNotIncluded[absFilename] =
-      this->ChecksumedPath(absFilename, "moc_", ".cpp");
+      this->ChecksumedPath(absFilename, "moc_", this->ConfigSuffix + ".cpp");
     this->MocFindDepends(absFilename, contentText, mocDepends);
   }
 }
@@ -1255,37 +1280,31 @@ bool cmQtAutoGenerators::MocGenerateAll(
   }
 
   // Generate moc files that are included by source files.
-  {
-    const std::string subDir = "include/";
-    for (std::map<std::string, std::string>::const_iterator it =
-           mocsIncluded.begin();
-         it != mocsIncluded.end(); ++it) {
-      if (!this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) {
-        if (this->MocRunFailed) {
-          return false;
-        }
+  for (std::map<std::string, std::string>::const_iterator it =
+         mocsIncluded.begin();
+       it != mocsIncluded.end(); ++it) {
+    if (!this->MocGenerateFile(it->first, it->second, mocDepends, true)) {
+      if (this->MocRunFailed) {
+        return false;
       }
     }
   }
 
   // Generate moc files that are _not_ included by source files.
   bool mocCompFileGenerated = false;
-  {
-    const std::string subDir;
-    for (std::map<std::string, std::string>::const_iterator it =
-           mocsNotIncluded.begin();
-         it != mocsNotIncluded.end(); ++it) {
-      if (this->MocGenerateFile(it->first, it->second, subDir, mocDepends)) {
-        mocCompFileGenerated = true;
-      } else {
-        if (this->MocRunFailed) {
-          return false;
-        }
+  for (std::map<std::string, std::string>::const_iterator it =
+         mocsNotIncluded.begin();
+       it != mocsNotIncluded.end(); ++it) {
+    if (this->MocGenerateFile(it->first, it->second, mocDepends, false)) {
+      mocCompFileGenerated = true;
+    } else {
+      if (this->MocRunFailed) {
+        return false;
       }
     }
   }
 
-  // Compose moc_compilation.cpp content
+  // Compose mocs compilation file content
   std::string automocSource;
   {
     std::ostringstream ost;
@@ -1304,18 +1323,18 @@ bool cmQtAutoGenerators::MocGenerateAll(
     automocSource = ost.str();
   }
 
-  if (this->FileDiffers(this->MocCppFilenameAbs, automocSource)) {
-    // Actually write moc_compilation.cpp
-    this->LogBold("Generating MOC compilation " + this->MocCppFilenameRel);
-    if (!this->FileWrite("AutoMoc", this->MocCppFilenameAbs, automocSource)) {
+  if (this->FileDiffers(this->MocCompFileAbs, automocSource)) {
+    // Actually write mocs compilation file
+    this->LogBold("Generating MOC compilation " + this->MocCompFileRel);
+    if (!this->FileWrite("AutoMoc", this->MocCompFileAbs, automocSource)) {
       return false;
     }
   } else if (mocCompFileGenerated) {
-    // Only touch moc_compilation.cpp
+    // Only touch mocs compilation file
     if (this->Verbose) {
-      this->LogInfo("Touching MOC compilation " + this->MocCppFilenameRel);
+      this->LogInfo("Touching MOC compilation " + this->MocCompFileRel);
     }
-    cmSystemTools::Touch(this->MocCppFilenameAbs, false);
+    cmSystemTools::Touch(this->MocCompFileAbs, false);
   }
 
   return true;
@@ -1326,14 +1345,14 @@ bool cmQtAutoGenerators::MocGenerateAll(
  */
 bool cmQtAutoGenerators::MocGenerateFile(
   const std::string& sourceFile, const std::string& mocFileName,
-  const std::string& subDir,
-  const std::map<std::string, std::set<std::string> >& mocDepends)
+  const std::map<std::string, std::set<std::string> >& mocDepends,
+  bool included)
 {
   bool mocGenerated = false;
   bool generateMoc = this->MocSettingsChanged || this->MocPredefsChanged;
 
   const std::string mocFileRel =
-    cmSystemTools::CollapseCombinedPath(subDir, mocFileName);
+    included ? (this->AutogenIncludeDir + mocFileName) : mocFileName;
   const std::string mocFileAbs =
     cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, mocFileRel);
 
@@ -1523,8 +1542,7 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
   bool uicGenerated = false;
   bool generateUic = this->UicSettingsChanged;
 
-  const std::string uicFileRel =
-    cmSystemTools::CollapseCombinedPath("include", uiOutputFile);
+  const std::string uicFileRel = this->AutogenIncludeDir + uiOutputFile;
   const std::string uicFileAbs =
     cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, uicFileRel);
 
@@ -1590,11 +1608,17 @@ bool cmQtAutoGenerators::RccGenerateAll()
 
   // generate single map with input / output names
   std::map<std::string, std::string> qrcGenMap;
-  for (std::vector<std::string>::const_iterator si = this->RccSources.begin();
-       si != this->RccSources.end(); ++si) {
-    const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
-    if (ext == ".qrc") {
-      qrcGenMap[*si] = this->ChecksumedPath(*si, "qrc_", ".cpp");
+  {
+    const std::string qrcPrefix = "qrc_";
+    const std::string qrcSuffix = this->ConfigSuffix + ".cpp";
+    for (std::vector<std::string>::const_iterator si =
+           this->RccSources.begin();
+         si != this->RccSources.end(); ++si) {
+      const std::string ext =
+        cmsys::SystemTools::GetFilenameLastExtension(*si);
+      if (ext == ".qrc") {
+        qrcGenMap[*si] = this->ChecksumedPath(*si, qrcPrefix, qrcSuffix);
+      }
     }
   }
 
@@ -1827,9 +1851,9 @@ bool cmQtAutoGenerators::NameCollisionTest(
  * @brief Generates a file path based on the checksum of the source file path
  * @return The path
  */
-std::string cmQtAutoGenerators::ChecksumedPath(const std::string& sourceFile,
-                                               const char* basePrefix,
-                                               const char* baseSuffix) const
+std::string cmQtAutoGenerators::ChecksumedPath(
+  const std::string& sourceFile, const std::string& basePrefix,
+  const std::string& baseSuffix) const
 {
   std::string res = FPathChecksum.getPart(sourceFile);
   res += "/";
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 9f329ac..b525364 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -107,8 +107,8 @@ private:
     const std::map<std::string, std::set<std::string> >& mocDepends);
   bool MocGenerateFile(
     const std::string& sourceFile, const std::string& mocFileName,
-    const std::string& subDir,
-    const std::map<std::string, std::set<std::string> >& mocDepends);
+    const std::map<std::string, std::set<std::string> >& mocDepends,
+    bool included);
 
   // -- Uic file generation
   bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile,
@@ -139,8 +139,8 @@ private:
     const std::map<std::string, std::string>& genFiles,
     std::multimap<std::string, std::string>& collisions) const;
   std::string ChecksumedPath(const std::string& sourceFile,
-                             const char* basePrefix,
-                             const char* baseSuffix) const;
+                             const std::string& basePrefix,
+                             const std::string& baseSuffix) const;
   bool MakeParentDirectory(const char* logPrefix,
                            const std::string& filename) const;
   bool FileDiffers(const std::string& filename, const std::string& content);
@@ -157,15 +157,15 @@ private:
   bool MocFindIncludedFile(std::string& absFile, const std::string& sourceFile,
                            const std::string& includeString) const;
 
-  // -- Target names
-  std::string OriginTargetName;
-  std::string AutogenTargetName;
+  // -- Meta
+  std::string ConfigSuffix;
   // -- Directories
   std::string ProjectSourceDir;
   std::string ProjectBinaryDir;
   std::string CurrentSourceDir;
   std::string CurrentBinaryDir;
   std::string AutogenBuildDir;
+  std::string AutogenIncludeDir;
   // -- Qt environment
   std::string QtMajorVersion;
   std::string MocExecutable;
@@ -189,8 +189,8 @@ private:
   bool MocPredefsChanged;
   bool MocRelaxedMode;
   bool MocRunFailed;
-  std::string MocCppFilenameRel;
-  std::string MocCppFilenameAbs;
+  std::string MocCompFileRel;
+  std::string MocCompFileAbs;
   std::string MocPredefsFileRel;
   std::string MocPredefsFileAbs;
   std::vector<std::string> MocSkipList;
diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt
index 70175fb..f57c6e7 100644
--- a/Tests/QtAutoUicInterface/CMakeLists.txt
+++ b/Tests/QtAutoUicInterface/CMakeLists.txt
@@ -64,6 +64,6 @@ target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET})
 add_executable(QtAutoUicInterface main.cpp)
 target_compile_definitions(QtAutoUicInterface
   PRIVATE
-    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/include/ui_libwidget.h"
-    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/include/ui_mywidget.h"
+    UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/include_${CMAKE_BUILD_TYPE}/ui_libwidget.h"
+    UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/include_${CMAKE_BUILD_TYPE}/ui_mywidget.h"
 )

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0965002e57f7461d290792252b289fda9247d530
commit 0965002e57f7461d290792252b289fda9247d530
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Mon May 15 10:37:42 2017 +0200
Commit:     Sebastian Holtermann <sebholt at xwmw.org>
CommitDate: Fri May 26 15:23:21 2017 +0200

    Autogen: Pass build directory in Info file

diff --git a/Modules/AutogenInfo.cmake.in b/Modules/AutogenInfo.cmake.in
index 5e945bc..9b4941c 100644
--- a/Modules/AutogenInfo.cmake.in
+++ b/Modules/AutogenInfo.cmake.in
@@ -7,6 +7,7 @@ set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
 set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
 set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
 set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
+set(AM_BUILD_DIR @_autogen_build_dir@)
 set(AM_SOURCES @_sources@)
 set(AM_HEADERS @_headers@)
 # Qt environment
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 239b18d..bc5095d 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -67,7 +67,7 @@ static std::string GetAutogenTargetFilesDir(cmGeneratorTarget const* target)
   targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
   targetDir += "/";
   targetDir += GetAutogenTargetName(target);
-  targetDir += ".dir/";
+  targetDir += ".dir";
   return targetDir;
 }
 
@@ -77,7 +77,6 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
   std::string targetDir = makefile->GetCurrentBinaryDirectory();
   targetDir += "/";
   targetDir += GetAutogenTargetName(target);
-  targetDir += "/";
   return targetDir;
 }
 
@@ -624,7 +623,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
   if (target->GetPropertyAsBool("AUTOMOC")) {
     cmMakefile* makefile = target->Target->GetMakefile();
     std::string mocCppFile = GetAutogenTargetBuildDir(target);
-    mocCppFile += "moc_compilation.cpp";
+    mocCppFile += "/moc_compilation.cpp";
     {
       cmSourceFile* gFile = makefile->GetOrCreateSource(mocCppFile, true);
       gFile->SetProperty("SKIP_AUTOGEN", "On");
@@ -706,14 +705,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   // Create autogen target includes directory and
   // add it to the origin target INCLUDE_DIRECTORIES
   if (mocEnabled || uicEnabled) {
-    const std::string incsDir = autogenBuildDir + "include";
+    const std::string incsDir = autogenBuildDir + "/include";
     cmSystemTools::MakeDirectory(incsDir);
     target->AddIncludeDirectory(incsDir, true);
   }
 
   // Register moc compilation file as generated
   if (mocEnabled) {
-    autogenProvides.push_back(autogenBuildDir + "moc_compilation.cpp");
+    autogenProvides.push_back(autogenBuildDir + "/moc_compilation.cpp");
   }
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
@@ -785,6 +784,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
           // Compose rcc output file name
           {
             std::string rccOut = autogenBuildDir;
+            rccOut += "/";
             rccOut += fpathCheckSum.getPart(absFile);
             rccOut += "/qrc_";
             rccOut +=
@@ -919,6 +919,8 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
       }
     }
 
+    AddDefinitionEscaped(makefile, "_autogen_build_dir",
+                         GetAutogenTargetBuildDir(target));
     AddDefinitionEscaped(makefile, "_autogen_target_name", autogenTargetName);
     AddDefinitionEscaped(makefile, "_origin_target_name", target->GetName());
     AddDefinitionEscaped(makefile, "_qt_version_major", qtMajorVersion);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index d40e809..19ae47a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -372,6 +372,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
   InfoGet(makefile, "AM_CMAKE_CURRENT_BINARY_DIR", this->CurrentBinaryDir);
   InfoGet(makefile, "AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE",
           this->IncludeProjectDirsBefore);
+  InfoGet(makefile, "AM_BUILD_DIR", this->AutogenBuildDir);
   InfoGet(makefile, "AM_SOURCES", this->Sources);
   InfoGet(makefile, "AM_HEADERS", this->Headers);
 
@@ -615,18 +616,15 @@ bool cmQtAutoGenerators::SettingsFileWrite()
 
 void cmQtAutoGenerators::Init(cmMakefile* makefile)
 {
-  this->AutogenBuildSubDir = this->AutogenTargetName;
-  this->AutogenBuildSubDir += "/";
-
-  this->MocCppFilenameRel = this->AutogenBuildSubDir;
-  this->MocCppFilenameRel += "moc_compilation.cpp";
-
-  this->MocCppFilenameAbs = this->CurrentBinaryDir + this->MocCppFilenameRel;
+  this->MocCppFilenameRel = "moc_compilation.cpp";
+  this->MocCppFilenameAbs = cmSystemTools::CollapseCombinedPath(
+    this->AutogenBuildDir, this->MocCppFilenameRel);
 
   // Moc predefs file
   if (!this->MocPredefsCmd.empty()) {
-    this->MocPredefsFileRel = this->AutogenBuildSubDir + "moc_predefs.h";
-    this->MocPredefsFileAbs = this->CurrentBinaryDir + this->MocPredefsFileRel;
+    this->MocPredefsFileRel = "moc_predefs.h";
+    this->MocPredefsFileAbs = cmSystemTools::CollapseCombinedPath(
+      this->AutogenBuildDir, this->MocPredefsFileRel);
   }
 
   // Init file path checksum generator
@@ -1335,8 +1333,9 @@ bool cmQtAutoGenerators::MocGenerateFile(
   bool generateMoc = this->MocSettingsChanged || this->MocPredefsChanged;
 
   const std::string mocFileRel =
-    this->AutogenBuildSubDir + subDir + mocFileName;
-  const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel;
+    cmSystemTools::CollapseCombinedPath(subDir, mocFileName);
+  const std::string mocFileAbs =
+    cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, mocFileRel);
 
   if (!generateMoc) {
     // Test if the source file is newer that the build file
@@ -1525,8 +1524,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
   bool generateUic = this->UicSettingsChanged;
 
   const std::string uicFileRel =
-    this->AutogenBuildSubDir + "include/" + uiOutputFile;
-  const std::string uicFileAbs = this->CurrentBinaryDir + uicFileRel;
+    cmSystemTools::CollapseCombinedPath("include", uiOutputFile);
+  const std::string uicFileAbs =
+    cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, uicFileRel);
 
   if (!generateUic) {
     // Test if the source file is newer that the build file
@@ -1594,8 +1594,7 @@ bool cmQtAutoGenerators::RccGenerateAll()
        si != this->RccSources.end(); ++si) {
     const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
     if (ext == ".qrc") {
-      qrcGenMap[*si] =
-        this->AutogenBuildSubDir + this->ChecksumedPath(*si, "qrc_", ".cpp");
+      qrcGenMap[*si] = this->ChecksumedPath(*si, "qrc_", ".cpp");
     }
   }
 
@@ -1636,7 +1635,8 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
   bool rccGenerated = false;
   bool generateRcc = this->RccSettingsChanged;
 
-  const std::string rccBuildFile = this->CurrentBinaryDir + rccOutputFile;
+  const std::string rccBuildFile =
+    cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, rccOutputFile);
 
   if (!generateRcc) {
     // Test if the resources list file is newer than build file
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 987110f..9f329ac 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -165,7 +165,7 @@ private:
   std::string ProjectBinaryDir;
   std::string CurrentSourceDir;
   std::string CurrentBinaryDir;
-  std::string AutogenBuildSubDir;
+  std::string AutogenBuildDir;
   // -- Qt environment
   std::string QtMajorVersion;
   std::string MocExecutable;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76bdb4076277cda0e68e1d80cdf715020eab5a7a
commit 76bdb4076277cda0e68e1d80cdf715020eab5a7a
Author:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
AuthorDate: Wed May 24 22:51:46 2017 +0300
Commit:     Pavel Solodovnikov <hellyeahdominate at gmail.com>
CommitDate: Wed May 24 23:30:57 2017 +0300

    Change std::basic_string<char> to std::string

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 8978e18..9f9cc6f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -348,12 +348,12 @@ bool cmSystemTools::IsInternallyOn(const char* val)
   if (!val) {
     return false;
   }
-  std::basic_string<char> v = val;
+  std::string v = val;
   if (v.size() > 4) {
     return false;
   }
 
-  for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) {
+  for (std::string::iterator c = v.begin(); c != v.end(); c++) {
     *c = static_cast<char>(toupper(*c));
   }
   return v == "I_ON";
@@ -368,7 +368,7 @@ bool cmSystemTools::IsOn(const char* val)
   if (len > 4) {
     return false;
   }
-  std::basic_string<char> v(val, len);
+  std::string v(val, len);
 
   static std::set<std::string> onValues;
   if (onValues.empty()) {
@@ -378,7 +378,7 @@ bool cmSystemTools::IsOn(const char* val)
     onValues.insert("TRUE");
     onValues.insert("Y");
   }
-  for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) {
+  for (std::string::iterator c = v.begin(); c != v.end(); c++) {
     *c = static_cast<char>(toupper(*c));
   }
   return (onValues.count(v) > 0);
@@ -413,8 +413,8 @@ bool cmSystemTools::IsOff(const char* val)
     offValues.insert("IGNORE");
   }
   // Try and avoid toupper().
-  std::basic_string<char> v(val, len);
-  for (std::basic_string<char>::iterator c = v.begin(); c != v.end(); c++) {
+  std::string v(val, len);
+  for (std::string::iterator c = v.begin(); c != v.end(); c++) {
     *c = static_cast<char>(toupper(*c));
   }
   return (offValues.count(v) > 0);

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

Summary of changes:
 Help/manual/cmake-properties.7.rst             |    1 +
 Help/manual/cmake-qt.7.rst                     |   23 +-
 Help/prop_tgt/AUTOGEN_BUILD_DIR.rst            |   17 ++
 Help/prop_tgt/AUTOMOC.rst                      |   35 ++-
 Help/prop_tgt/AUTOUIC.rst                      |    9 +-
 Help/release/dev/Autogen_build_dir.rst         |    6 +
 Help/release/dev/FindProtobuf-export-macro.rst |    6 +
 Modules/AutogenInfo.cmake.in                   |    4 +-
 Modules/FindBoost.cmake                        |   16 +-
 Modules/FindProtobuf.cmake                     |   21 +-
 Source/cmAddCustomTargetCommand.cxx            |    2 +-
 Source/cmAddDependenciesCommand.cxx            |    2 +-
 Source/cmAddExecutableCommand.cxx              |    2 +-
 Source/cmAddLibraryCommand.cxx                 |    2 +-
 Source/cmAddSubDirectoryCommand.cxx            |    2 +-
 Source/cmAuxSourceDirectoryCommand.cxx         |    6 +-
 Source/cmBuildCommand.cxx                      |    4 +-
 Source/cmCMakeHostSystemInformationCommand.cxx |    4 +-
 Source/cmConfigureFileCommand.cxx              |    4 +-
 Source/cmDefinePropertyCommand.cxx             |   18 +-
 Source/cmExtraCodeBlocksGenerator.cxx          |    8 +-
 Source/cmExtraCodeLiteGenerator.cxx            |    5 +-
 Source/cmExtraEclipseCDT4Generator.cxx         |    4 +-
 Source/cmFileCommand.cxx                       |    2 +-
 Source/cmFindPackageCommand.cxx                |    6 +-
 Source/cmGetCMakePropertyCommand.cxx           |    2 +-
 Source/cmGetDirectoryPropertyCommand.cxx       |    2 +-
 Source/cmGetSourceFilePropertyCommand.cxx      |    4 +-
 Source/cmGetTargetPropertyCommand.cxx          |    4 +-
 Source/cmGetTestPropertyCommand.cxx            |    4 +-
 Source/cmGlobalKdevelopGenerator.cxx           |    2 +-
 Source/cmGlobalNinjaGenerator.cxx              |    2 +-
 Source/cmInstallCommand.cxx                    |   20 +-
 Source/cmInstallFilesCommand.cxx               |    6 +-
 Source/cmLocalGenerator.cxx                    |    2 +-
 Source/cmLocalNinjaGenerator.cxx               |    2 +-
 Source/cmMarkAsAdvancedCommand.cxx             |    2 +-
 Source/cmNewLineStyle.cxx                      |    2 +-
 Source/cmOSXBundleGenerator.cxx                |    4 +-
 Source/cmProjectCommand.cxx                    |   41 +--
 Source/cmQtAutoGeneratorInitializer.cxx        |  382 +++++++++++++++---------
 Source/cmQtAutoGenerators.cxx                  |  162 +++++-----
 Source/cmQtAutoGenerators.h                    |   20 +-
 Source/cmRemoveCommand.cxx                     |    2 +-
 Source/cmSetPropertyCommand.cxx                |   12 +-
 Source/cmStringCommand.cxx                     |   22 +-
 Source/cmSystemTools.cxx                       |   13 +-
 Source/cmTargetPropCommandBase.cxx             |    2 +-
 Source/cmUtilitySourceCommand.cxx              |    6 +-
 Source/cmVariableRequiresCommand.cxx           |    4 +-
 Source/cmVariableWatchCommand.cxx              |    2 +-
 Source/cmWriteFileCommand.cxx                  |    2 +-
 Source/cmake.cxx                               |    6 +-
 Source/cmcmd.cxx                               |   16 +-
 Tests/QtAutoUicInterface/CMakeLists.txt        |   10 +-
 55 files changed, 586 insertions(+), 383 deletions(-)
 create mode 100644 Help/prop_tgt/AUTOGEN_BUILD_DIR.rst
 create mode 100644 Help/release/dev/Autogen_build_dir.rst
 create mode 100644 Help/release/dev/FindProtobuf-export-macro.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list