[Cmake-commits] CMake branch, master, updated. v3.10.2-978-ga7ee918

Kitware Robot kwrobot at kitware.com
Wed Jan 31 08:35:07 EST 2018


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  a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6 (commit)
       via  3fd01be56bfa0215bcabbe27f1690654c3755b43 (commit)
       via  174693dafe2dcc7dad6394ed051791da39ff05b1 (commit)
       via  0a37b515affb386472758e43d53efa983dbe0701 (commit)
       via  efa5a26d021cf5476bebff54dd28f115c962ae9b (commit)
       via  063684503b5b5a696559b3c3cea2f1d3cc8dee29 (commit)
       via  a50828cc519d57016acc86074a446181532974ce (commit)
       via  aed227fd5ae6775a5bbdd54540666a70163c9fcb (commit)
       via  9e341f05b033e0a4835a43cf6c68b922dfd11f6e (commit)
       via  365e02e73ea9e6177ff5fb6de73e4187eded8afc (commit)
       via  4443adc1c0450a49a4413669a8ade5487f9f3026 (commit)
       via  1fe66c462b3232a6f549b868d2f9ccd73c8bd1d0 (commit)
       via  9f74aaeb7d6649241c4a478410e87d092c462960 (commit)
       via  f83330ed6cefc8ff6332db6bc9aca30b8c12c3e9 (commit)
       via  79f22e84089e3f7a29cfea3275af6fafc5d3c091 (commit)
      from  f5b5a72096236cbcac46bbcf57c6e39a1909bb90 (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=a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6
commit a7ee918f197300ffed8f4ae0fafe6c3c2f4ea1b6
Merge: 3fd01be aed227f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:34:41 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:34:59 2018 -0500

    Merge topic 'generate_speedup'
    
    aed227fd cmLocalGenerator: change ImportedGeneratorTargets from vector to map
    4443adc1 cmLocalGenerator: remove public GetImportedGeneratorTargets
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Attila Krasznahorkay <attila.krasznahorkay at gmail.com>
    Merge-request: !1717


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3fd01be56bfa0215bcabbe27f1690654c3755b43
commit 3fd01be56bfa0215bcabbe27f1690654c3755b43
Merge: 174693d 365e02e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:34:17 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:34:24 2018 -0500

    Merge topic 'source_group-TREE-args'
    
    365e02e7 source_group: Fix TREE argument parsing
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1713


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=174693dafe2dcc7dad6394ed051791da39ff05b1
commit 174693dafe2dcc7dad6394ed051791da39ff05b1
Merge: 0a37b51 9e341f0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:33:22 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:33:29 2018 -0500

    Merge topic 'CheckIPOSupported-doc-Fortran'
    
    9e341f05 CheckIPOSupported: Document existing Fortran support
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1727


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a37b515affb386472758e43d53efa983dbe0701
commit 0a37b515affb386472758e43d53efa983dbe0701
Merge: efa5a26 1fe66c4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:32:46 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:33:00 2018 -0500

    Merge topic 'vs-restore-order'
    
    1fe66c46 VS: Restore the order of the AdditionalIncludeDirectories tag
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1719


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efa5a26d021cf5476bebff54dd28f115c962ae9b
commit efa5a26d021cf5476bebff54dd28f115c962ae9b
Merge: 0636845 79f22e8
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:32:01 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:32:27 2018 -0500

    Merge topic 'dedup-ComputeObjectFilenames'
    
    79f22e84 Makefile,Ninja: De-duplicate ComputeObjectFilenames method
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1715


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=063684503b5b5a696559b3c3cea2f1d3cc8dee29
commit 063684503b5b5a696559b3c3cea2f1d3cc8dee29
Merge: a50828c f83330e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:31:19 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:31:49 2018 -0500

    Merge topic 'adsp-asmembler-identification'
    
    f83330ed ASM: ADSP assembler identification
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1723


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a50828cc519d57016acc86074a446181532974ce
commit a50828cc519d57016acc86074a446181532974ce
Merge: f5b5a72 9f74aae
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 31 13:30:44 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jan 31 08:31:06 2018 -0500

    Merge topic 'FindCUDA-restore-config-types'
    
    9f74aaeb FindCUDA: Fix regression in per-config flags
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1725


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aed227fd5ae6775a5bbdd54540666a70163c9fcb
commit aed227fd5ae6775a5bbdd54540666a70163c9fcb
Author:     Frank Winklmeier <frank.winklmeier at cern.ch>
AuthorDate: Mon Jan 29 16:11:07 2018 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 30 14:04:37 2018 -0500

    cmLocalGenerator: change ImportedGeneratorTargets from vector to map
    
    For large number of targets significant amount of time is spent in
    cmLocalGenerator::FindGeneratorTargetToUse, which uses find_if on a
    vector to locate the given target. Using a map instead of vector for
    ImportedGeneratorTargets (as done for cmMakefile::ImportedTargets)
    provides a significant speedup (up to factor of 2).

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 859aa44..afdcc84 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -553,14 +553,13 @@ void cmLocalGenerator::GenerateInstallRules()
 void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
 {
   this->GeneratorTargets.push_back(gt);
-  this->GeneratorTargetSearchIndex.insert(
-    std::pair<std::string, cmGeneratorTarget*>(gt->GetName(), gt));
+  this->GeneratorTargetSearchIndex.emplace(gt->GetName(), gt);
   this->GlobalGenerator->IndexGeneratorTarget(gt);
 }
 
 void cmLocalGenerator::AddImportedGeneratorTarget(cmGeneratorTarget* gt)
 {
-  this->ImportedGeneratorTargets.push_back(gt);
+  this->ImportedGeneratorTargets.emplace(gt->GetName(), gt);
   this->GlobalGenerator->IndexGeneratorTarget(gt);
 }
 
@@ -569,22 +568,6 @@ void cmLocalGenerator::AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt)
   this->OwnedImportedGeneratorTargets.push_back(gt);
 }
 
-struct NamedGeneratorTargetFinder
-{
-  NamedGeneratorTargetFinder(std::string const& name)
-    : Name(name)
-  {
-  }
-
-  bool operator()(cmGeneratorTarget* tgt)
-  {
-    return tgt->GetName() == this->Name;
-  }
-
-private:
-  std::string Name;
-};
-
 cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
   const std::string& name) const
 {
@@ -1395,11 +1378,10 @@ void cmLocalGenerator::AddLanguageFlagsForLinking(
 cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse(
   const std::string& name) const
 {
-  std::vector<cmGeneratorTarget*>::const_iterator imported = std::find_if(
-    this->ImportedGeneratorTargets.begin(),
-    this->ImportedGeneratorTargets.end(), NamedGeneratorTargetFinder(name));
+  GeneratorTargetMap::const_iterator imported =
+    this->ImportedGeneratorTargets.find(name);
   if (imported != this->ImportedGeneratorTargets.end()) {
-    return *imported;
+    return imported->second;
   }
 
   if (cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name)) {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 2131085..58bbe77 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -389,7 +389,7 @@ protected:
   std::vector<cmGeneratorTarget*> GeneratorTargets;
 
   std::set<cmGeneratorTarget const*> WarnCMP0063;
-  std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
+  GeneratorTargetMap ImportedGeneratorTargets;
   std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
   std::map<std::string, std::string> AliasTargets;
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e341f05b033e0a4835a43cf6c68b922dfd11f6e
commit 9e341f05b033e0a4835a43cf6c68b922dfd11f6e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jan 30 12:58:24 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 30 12:58:41 2018 -0500

    CheckIPOSupported: Document existing Fortran support
    
    Support was added by commit v3.9.0-rc1~318^2 (CheckIPOSupported: Add
    Fortran support, 2017-04-02) but the documentation was not updated.

diff --git a/Modules/CheckIPOSupported.cmake b/Modules/CheckIPOSupported.cmake
index e04ab1c..d8297d9 100644
--- a/Modules/CheckIPOSupported.cmake
+++ b/Modules/CheckIPOSupported.cmake
@@ -26,7 +26,7 @@ property.
     Set ``<output>`` variable with details about any error.
   ``LANGUAGES <lang>...``
     Specify languages whose compilers to check.
-    Languages ``C`` and ``CXX`` are supported.
+    Languages ``C``, ``CXX``, and ``Fortran`` are supported.
 
 It makes no sense to use this module when :policy:`CMP0069` is set to ``OLD`` so
 module will return error in this case. See policy :policy:`CMP0069` for details.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=365e02e73ea9e6177ff5fb6de73e4187eded8afc
commit 365e02e73ea9e6177ff5fb6de73e4187eded8afc
Author:     Mateusz Janek <stryku2393 at gmail.com>
AuthorDate: Thu Jan 25 07:28:53 2018 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 30 12:49:26 2018 -0500

    source_group: Fix TREE argument parsing
    
    Fixes: #17581

diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 69983a8..87ecc56 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -2,19 +2,21 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmSourceGroupCommand.h"
 
+#include <algorithm>
 #include <set>
-#include <sstream>
 #include <stddef.h>
+#include <utility>
 
 #include "cmMakefile.h"
 #include "cmSourceGroup.h"
 #include "cmSystemTools.h"
 
 namespace {
-const size_t RootIndex = 1;
-const size_t FilesWithoutPrefixKeywordIndex = 2;
-const size_t FilesWithPrefixKeywordIndex = 4;
-const size_t PrefixKeywordIndex = 2;
+const std::string kTreeOptionName = "TREE";
+const std::string kPrefixOptionName = "PREFIX";
+const std::string kFilesOptionName = "FILES";
+const std::string kRegexOptionName = "REGULAR_EXPRESSION";
+const std::string kSourceGroupOptionName = "<sg_name>";
 
 std::vector<std::string> tokenizePath(const std::string& path)
 {
@@ -71,14 +73,13 @@ std::string prepareFilePathForTree(const std::string& path,
 }
 
 std::vector<std::string> prepareFilesPathsForTree(
-  std::vector<std::string>::const_iterator begin,
-  std::vector<std::string>::const_iterator end,
+  const std::vector<std::string>& filesPaths,
   const std::string& currentSourceDir)
 {
   std::vector<std::string> prepared;
 
-  for (; begin != end; ++begin) {
-    prepared.push_back(prepareFilePathForTree(*begin, currentSourceDir));
+  for (auto const& filePath : filesPaths) {
+    prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
   }
 
   return prepared;
@@ -121,6 +122,57 @@ bool addFilesToItsSourceGroups(const std::string& root,
 class cmExecutionStatus;
 
 // cmSourceGroupCommand
+cmSourceGroupCommand::ExpectedOptions
+cmSourceGroupCommand::getExpectedOptions() const
+{
+  ExpectedOptions options;
+
+  options.push_back(kTreeOptionName);
+  options.push_back(kPrefixOptionName);
+  options.push_back(kFilesOptionName);
+  options.push_back(kRegexOptionName);
+
+  return options;
+}
+
+bool cmSourceGroupCommand::isExpectedOption(
+  const std::string& argument, const ExpectedOptions& expectedOptions)
+{
+  return std::find(expectedOptions.begin(), expectedOptions.end(), argument) !=
+    expectedOptions.end();
+}
+
+void cmSourceGroupCommand::parseArguments(
+  const std::vector<std::string>& args,
+  cmSourceGroupCommand::ParsedArguments& parsedArguments)
+{
+  const ExpectedOptions expectedOptions = getExpectedOptions();
+  size_t i = 0;
+
+  // at this point we know that args vector is not empty
+
+  // if first argument is not one of expected options it's source group name
+  if (!isExpectedOption(args[0], expectedOptions)) {
+    // get source group name and go to next argument
+    parsedArguments[kSourceGroupOptionName].push_back(args[0]);
+    ++i;
+  }
+
+  for (; i < args.size();) {
+    // get current option and increment index to go to next argument
+    const std::string& currentOption = args[i++];
+
+    // create current option entry in parsed arguments
+    std::vector<std::string>& currentOptionArguments =
+      parsedArguments[currentOption];
+
+    // collect option arguments while we won't find another expected option
+    while (i < args.size() && !isExpectedOption(args[i], expectedOptions)) {
+      currentOptionArguments.push_back(args[i++]);
+    }
+  }
+}
+
 bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
                                        cmExecutionStatus&)
 {
@@ -129,114 +181,98 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
     return false;
   }
 
-  if (args[0] == "TREE") {
-    std::string error;
+  // If only two arguments are given, the pre-1.8 version of the
+  // command is being invoked.
+  if (args.size() == 2 && args[1] != "FILES") {
+    cmSourceGroup* sg = this->Makefile->GetOrCreateSourceGroup(args[0]);
 
-    if (!processTree(args, error)) {
-      this->SetError(error);
+    if (!sg) {
+      this->SetError("Could not create or find source group");
       return false;
     }
 
+    sg->SetGroupRegex(args[1].c_str());
     return true;
   }
 
-  cmSourceGroup* sg = this->Makefile->GetOrCreateSourceGroup(args[0]);
+  ParsedArguments parsedArguments;
+  std::string errorMsg;
 
-  if (!sg) {
-    this->SetError("Could not create or find source group");
+  parseArguments(args, parsedArguments);
+
+  if (!checkArgumentsPreconditions(parsedArguments, errorMsg)) {
     return false;
   }
-  // If only two arguments are given, the pre-1.8 version of the
-  // command is being invoked.
-  if (args.size() == 2 && args[1] != "FILES") {
-    sg->SetGroupRegex(args[1].c_str());
-    return true;
-  }
 
-  // Process arguments.
-  bool doingFiles = false;
-  for (unsigned int i = 1; i < args.size(); ++i) {
-    if (args[i] == "REGULAR_EXPRESSION") {
-      // Next argument must specify the regex.
-      if (i + 1 < args.size()) {
-        ++i;
-        sg->SetGroupRegex(args[i].c_str());
-      } else {
-        this->SetError("REGULAR_EXPRESSION argument given without a regex.");
-        return false;
-      }
-      doingFiles = false;
-    } else if (args[i] == "FILES") {
-      // Next arguments will specify files.
-      doingFiles = true;
-    } else if (doingFiles) {
-      // Convert name to full path and add to the group's list.
-      std::string src = args[i];
+  if (parsedArguments.find(kTreeOptionName) != parsedArguments.end()) {
+    if (!processTree(parsedArguments, errorMsg)) {
+      this->SetError(errorMsg);
+      return false;
+    }
+  } else {
+    if (parsedArguments.find(kSourceGroupOptionName) ==
+        parsedArguments.end()) {
+      this->SetError("Missing source group name.");
+      return false;
+    }
+
+    cmSourceGroup* sg = this->Makefile->GetOrCreateSourceGroup(args[0]);
+
+    if (!sg) {
+      this->SetError("Could not create or find source group");
+      return false;
+    }
+
+    // handle regex
+    if (parsedArguments.find(kRegexOptionName) != parsedArguments.end()) {
+      const std::string& sgRegex = parsedArguments[kRegexOptionName].front();
+      sg->SetGroupRegex(sgRegex.c_str());
+    }
+
+    // handle files
+    const std::vector<std::string>& filesArguments =
+      parsedArguments[kFilesOptionName];
+    for (auto const& filesArg : filesArguments) {
+      std::string src = filesArg;
       if (!cmSystemTools::FileIsFullPath(src.c_str())) {
         src = this->Makefile->GetCurrentSourceDirectory();
         src += "/";
-        src += args[i];
+        src += filesArg;
       }
       src = cmSystemTools::CollapseFullPath(src);
       sg->AddGroupFile(src);
-    } else {
-      std::ostringstream err;
-      err << "Unknown argument \"" << args[i] << "\".  "
-          << "Perhaps the FILES keyword is missing.\n";
-      this->SetError(err.str());
-      return false;
     }
   }
 
   return true;
 }
 
-bool cmSourceGroupCommand::checkTreeArgumentsPreconditions(
-  const std::vector<std::string>& args, std::string& errorMsg) const
+bool cmSourceGroupCommand::checkArgumentsPreconditions(
+  const ParsedArguments& parsedArguments, std::string& errorMsg) const
 {
-  if (args.size() == 1) {
-    errorMsg = "TREE argument given without a root.";
-    return false;
-  }
-
-  if (args.size() < 3) {
-    errorMsg = "Missing FILES arguments.";
-    return false;
-  }
-
-  if (args[FilesWithoutPrefixKeywordIndex] != "FILES" &&
-      args[PrefixKeywordIndex] != "PREFIX") {
-    errorMsg = "Unknown argument \"" + args[2] +
-      "\". Perhaps the FILES keyword is missing.\n";
-    return false;
-  }
-
-  if (args[PrefixKeywordIndex] == "PREFIX" &&
-      (args.size() < 5 || args[FilesWithPrefixKeywordIndex] != "FILES")) {
-    errorMsg = "Missing FILES arguments.";
+  if (!checkSingleParameterArgumentPreconditions(kPrefixOptionName,
+                                                 parsedArguments, errorMsg) ||
+      !checkSingleParameterArgumentPreconditions(kTreeOptionName,
+                                                 parsedArguments, errorMsg) ||
+      !checkSingleParameterArgumentPreconditions(kRegexOptionName,
+                                                 parsedArguments, errorMsg)) {
     return false;
   }
 
   return true;
 }
 
-bool cmSourceGroupCommand::processTree(const std::vector<std::string>& args,
+bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments,
                                        std::string& errorMsg)
 {
-  if (!checkTreeArgumentsPreconditions(args, errorMsg)) {
-    return false;
-  }
-
-  const std::string root = cmSystemTools::CollapseFullPath(args[RootIndex]);
-  std::string prefix;
-  size_t filesBegin = FilesWithoutPrefixKeywordIndex + 1;
-  if (args[PrefixKeywordIndex] == "PREFIX") {
-    prefix = args[PrefixKeywordIndex + 1];
-    filesBegin = FilesWithPrefixKeywordIndex + 1;
-  }
+  const std::string root =
+    cmSystemTools::CollapseFullPath(parsedArguments[kTreeOptionName].front());
+  std::string prefix = parsedArguments[kPrefixOptionName].empty()
+    ? ""
+    : parsedArguments[kPrefixOptionName].front();
 
   const std::vector<std::string> filesVector =
-    prepareFilesPathsForTree(args.begin() + filesBegin, args.end(),
+    prepareFilesPathsForTree(parsedArguments[kFilesOptionName],
                              this->Makefile->GetCurrentSourceDirectory());
 
   if (!rootIsPrefix(root, filesVector, errorMsg)) {
@@ -253,3 +289,25 @@ bool cmSourceGroupCommand::processTree(const std::vector<std::string>& args,
 
   return true;
 }
+
+bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions(
+  const std::string& argument, const ParsedArguments& parsedArguments,
+  std::string& errorMsg) const
+{
+  ParsedArguments::const_iterator foundArgument =
+    parsedArguments.find(argument);
+  if (foundArgument != parsedArguments.end()) {
+    const std::vector<std::string>& optionArguments = foundArgument->second;
+
+    if (optionArguments.empty()) {
+      errorMsg = argument + " argument given without an argument.";
+      return false;
+    }
+    if (optionArguments.size() > 1) {
+      errorMsg = "too many arguments passed to " + argument + ".";
+      return false;
+    }
+  }
+
+  return true;
+}
diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h
index ed02ca5..ec5ad32 100644
--- a/Source/cmSourceGroupCommand.h
+++ b/Source/cmSourceGroupCommand.h
@@ -5,6 +5,7 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
+#include <map>
 #include <string>
 #include <vector>
 
@@ -34,10 +35,24 @@ public:
                    cmExecutionStatus& status) override;
 
 private:
-  bool processTree(const std::vector<std::string>& args,
-                   std::string& errorMsg);
-  bool checkTreeArgumentsPreconditions(const std::vector<std::string>& args,
-                                       std::string& errorMsg) const;
+  typedef std::map<std::string, std::vector<std::string>> ParsedArguments;
+  typedef std::vector<std::string> ExpectedOptions;
+
+  ExpectedOptions getExpectedOptions() const;
+
+  bool isExpectedOption(const std::string& argument,
+                        const ExpectedOptions& expectedOptions);
+
+  void parseArguments(const std::vector<std::string>& args,
+                      cmSourceGroupCommand::ParsedArguments& parsedArguments);
+
+  bool processTree(ParsedArguments& parsedArguments, std::string& errorMsg);
+
+  bool checkArgumentsPreconditions(const ParsedArguments& parsedArguments,
+                                   std::string& errorMsg) const;
+  bool checkSingleParameterArgumentPreconditions(
+    const std::string& argument, const ParsedArguments& parsedArguments,
+    std::string& errorMsg) const;
 };
 
 #endif
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 4e4a030..813774d 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -39,9 +39,15 @@ set(tree_files_without_prefix ${root}/sub1/tree_bar.c
 set(tree_files_with_prefix ${root}/tree_prefix_foo.c
                            tree_prefix_bar.c)
 
+set(tree_files_with_empty_prefix ${root}/tree_empty_prefix_foo.c
+                                 tree_empty_prefix_bar.c)
+
 source_group(TREE ${root} FILES ${tree_files_without_prefix})
 
-source_group(TREE ${root} PREFIX tree_root/subgroup FILES ${tree_files_with_prefix})
+source_group(FILES ${tree_files_with_prefix} PREFIX tree_root/subgroup TREE ${root})
+
+source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root})
 
 add_executable(SourceGroups main.c bar.c foo.c sub1/foo.c sub1/foobar.c baz.c
-                            ${tree_files_with_prefix} ${tree_files_without_prefix} README.txt)
+                            ${tree_files_with_prefix} ${tree_files_without_prefix}
+                            ${tree_files_with_empty_prefix} README.txt)
diff --git a/Tests/SourceGroups/main.c b/Tests/SourceGroups/main.c
index 4d84cf2..87225f5 100644
--- a/Tests/SourceGroups/main.c
+++ b/Tests/SourceGroups/main.c
@@ -7,6 +7,8 @@ extern int barbar(void);
 extern int baz(void);
 extern int tree_prefix_foo(void);
 extern int tree_prefix_bar(void);
+extern int tree_empty_prefix_foo(void);
+extern int tree_empty_prefix_bar(void);
 extern int tree_bar(void);
 extern int tree_foobar(void);
 extern int tree_baz(void);
@@ -17,8 +19,9 @@ int main()
          foobar(), barbar(), baz());
 
   printf("tree_prefix_foo: %d tree_prefix_bar: %d tree_bar: %d tree_foobar: "
-         "%d tree_baz: %d\n",
+         "%d tree_baz: %d  tree_empty_prefix_foo: %d "
+         "tree_empty_prefix_bar: %d\n",
          tree_prefix_foo(), tree_prefix_bar(), tree_bar(), tree_foobar(),
-         tree_baz());
+         tree_baz(), tree_empty_prefix_foo(), tree_empty_prefix_bar());
   return 0;
 }
diff --git a/Tests/SourceGroups/tree_empty_prefix_bar.c b/Tests/SourceGroups/tree_empty_prefix_bar.c
new file mode 100644
index 0000000..d974c6e
--- /dev/null
+++ b/Tests/SourceGroups/tree_empty_prefix_bar.c
@@ -0,0 +1,4 @@
+int tree_empty_prefix_bar(void)
+{
+  return 66;
+}
diff --git a/Tests/SourceGroups/tree_empty_prefix_foo.c b/Tests/SourceGroups/tree_empty_prefix_foo.c
new file mode 100644
index 0000000..277cbd4
--- /dev/null
+++ b/Tests/SourceGroups/tree_empty_prefix_foo.c
@@ -0,0 +1,4 @@
+int tree_empty_prefix_foo(void)
+{
+  return 6;
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4443adc1c0450a49a4413669a8ade5487f9f3026
commit 4443adc1c0450a49a4413669a8ade5487f9f3026
Author:     Frank Winklmeier <frank.winklmeier at cern.ch>
AuthorDate: Tue Jan 30 17:51:14 2018 +0100
Commit:     Frank Winklmeier <frank.winklmeier at cern.ch>
CommitDate: Tue Jan 30 17:51:14 2018 +0100

    cmLocalGenerator: remove public GetImportedGeneratorTargets
    
    GetImportedGeneratorTargets is not used anywhere hence remove it
    to avoid exposing the type of ImportedGeneratorTargets.

diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index a66fa6e..2131085 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -139,11 +139,6 @@ public:
     return this->GeneratorTargets;
   }
 
-  const std::vector<cmGeneratorTarget*>& GetImportedGeneratorTargets() const
-  {
-    return this->ImportedGeneratorTargets;
-  }
-
   void AddGeneratorTarget(cmGeneratorTarget* gt);
   void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
   void AddOwnedImportedGeneratorTarget(cmGeneratorTarget* gt);

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1fe66c462b3232a6f549b868d2f9ccd73c8bd1d0
commit 1fe66c462b3232a6f549b868d2f9ccd73c8bd1d0
Author:     Vitaly Stakhovsky <vvs31415 at gitlab.org>
AuthorDate: Mon Jan 29 12:59:53 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 30 08:53:04 2018 -0500

    VS: Restore the order of the AdditionalIncludeDirectories tag
    
    Move the `AdditionalIncludeDirectories` tag back to the VS-preferred
    location in `.vcxproj` files.
    
    Fixes: #17691

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 4555358..51b9922 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2169,9 +2169,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
       clOptions.AddIncludes(includeList);
       clOptions.SetConfiguration(config.c_str());
       clOptions.PrependInheritedString("AdditionalOptions");
-      clOptions.OutputFlagMap(*this->BuildFileStream, "      ");
       clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream,
                                                    "      ", "\n", lang);
+      clOptions.OutputFlagMap(*this->BuildFileStream, "      ");
       clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, "      ",
                                               "\n", lang);
     }
@@ -2535,9 +2535,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
   }
   this->WriteString("<ClCompile>\n", 2);
   clOptions.PrependInheritedString("AdditionalOptions");
-  clOptions.OutputFlagMap(*this->BuildFileStream, "      ");
   clOptions.OutputAdditionalIncludeDirectories(
     *this->BuildFileStream, "      ", "\n", this->LangForClCompile);
+  clOptions.OutputFlagMap(*this->BuildFileStream, "      ");
   clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, "      ",
                                           "\n", this->LangForClCompile);
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f74aaeb7d6649241c4a478410e87d092c462960
commit 9f74aaeb7d6649241c4a478410e87d092c462960
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jan 30 08:18:11 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jan 30 08:18:11 2018 -0500

    FindCUDA: Fix regression in per-config flags
    
    Changes in commit 48f7e2d300 (Unhardcode the CMAKE_CONFIGURATION_TYPES
    values, 2017-11-27) accidentally left `CUDA_configuration_types`
    undefined, but this is used in a few places to handle per-config flags.
    Restore it.
    
    Fixes: #17671

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 0decbb5..0a31ac2 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -585,6 +585,18 @@ mark_as_advanced(
   CUDA_SEPARABLE_COMPILATION
   )
 
+# Single config generators like Makefiles or Ninja don't usually have
+# CMAKE_CONFIGURATION_TYPES defined (but note that it can be defined if set by
+# projects or developers). Even CMAKE_BUILD_TYPE might not be defined for
+# single config generators (and should not be defined for multi-config
+# generators). To ensure we get a complete superset of all possible
+# configurations, we combine CMAKE_CONFIGURATION_TYPES, CMAKE_BUILD_TYPE and
+# all of the standard configurations, then weed out duplicates with
+# list(REMOVE_DUPLICATES). Looping over the unique set then ensures we have
+# each configuration-specific set of nvcc flags defined and marked as advanced.
+set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
+list(REMOVE_DUPLICATES CUDA_configuration_types)
+
 ###############################################################################
 ###############################################################################
 # Locate CUDA, Set Build Type, etc.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f83330ed6cefc8ff6332db6bc9aca30b8c12c3e9
commit f83330ed6cefc8ff6332db6bc9aca30b8c12c3e9
Author:     Anton Danielsson <danielsson.anton at gmail.com>
AuthorDate: Tue Jan 30 10:05:09 2018 +0100
Commit:     Anton Danielsson <danielsson.anton at gmail.com>
CommitDate: Tue Jan 30 10:06:01 2018 +0100

    ASM: ADSP assembler identification
    
    Add support to identify the ADSP (Analog Devices) assembler
    in CMakeDetermineASMCompiler.
    
    Fixes: #17695

diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index ed8f598..24048ed 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -100,6 +100,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
   set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_YASM "--version")
   set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_YASM "(yasm)")
 
+  list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ADSP)
+  set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ADSP "-version")
+  set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ADSP "Analog Devices")
+
   include(CMakeDetermineCompilerId)
   set(userflags)
   CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=79f22e84089e3f7a29cfea3275af6fafc5d3c091
commit 79f22e84089e3f7a29cfea3275af6fafc5d3c091
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jan 29 10:20:47 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jan 29 10:51:22 2018 -0500

    Makefile,Ninja: De-duplicate ComputeObjectFilenames method
    
    Move the method implementation up to `cmLocalCommonGenerator`
    to avoid duplicating it in each generator.

diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx
index 50ebfa1..5a43f2e 100644
--- a/Source/cmLocalCommonGenerator.cxx
+++ b/Source/cmLocalCommonGenerator.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmLocalCommonGenerator.h"
 
+#include <utility>
 #include <vector>
 
 #include "cmGeneratorTarget.h"
@@ -76,3 +77,17 @@ std::string cmLocalCommonGenerator::GetTargetFortranFlags(
 
   return flags;
 }
+
+void cmLocalCommonGenerator::ComputeObjectFilenames(
+  std::map<cmSourceFile const*, std::string>& mapping,
+  cmGeneratorTarget const* gt)
+{
+  // Determine if these object files should use a custom extension
+  char const* custom_ext = gt->GetCustomObjectExtension();
+  for (auto& si : mapping) {
+    cmSourceFile const* sf = si.first;
+    bool keptSourceExtension;
+    si.second = this->GetObjectFileNameWithoutTarget(
+      *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext);
+  }
+}
diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h
index a60573c..7b8e6fe 100644
--- a/Source/cmLocalCommonGenerator.h
+++ b/Source/cmLocalCommonGenerator.h
@@ -5,6 +5,7 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
+#include <map>
 #include <string>
 
 #include "cmLocalGenerator.h"
@@ -12,6 +13,7 @@
 class cmGeneratorTarget;
 class cmGlobalGenerator;
 class cmMakefile;
+class cmSourceFile;
 
 /** \class cmLocalCommonGenerator
  * \brief Common infrastructure for Makefile and Ninja local generators.
@@ -30,6 +32,10 @@ public:
   std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
                                     std::string const& config) override;
 
+  void ComputeObjectFilenames(
+    std::map<cmSourceFile const*, std::string>& mapping,
+    cmGeneratorTarget const* gt = nullptr) override;
+
 protected:
   std::string WorkingDirectory;
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 2d969d2..8c889fc 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -246,20 +246,6 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
   os << "\n";
 }
 
-void cmLocalNinjaGenerator::ComputeObjectFilenames(
-  std::map<cmSourceFile const*, std::string>& mapping,
-  cmGeneratorTarget const* gt)
-{
-  // Determine if these object files should use a custom extension
-  char const* custom_ext = gt->GetCustomObjectExtension();
-  for (auto& si : mapping) {
-    cmSourceFile const* sf = si.first;
-    bool keptSourceExtension;
-    si.second = this->GetObjectFileNameWithoutTarget(
-      *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext);
-  }
-}
-
 void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index bb16899..95d8a61 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -23,7 +23,6 @@ class cmGlobalGenerator;
 class cmGlobalNinjaGenerator;
 class cmMakefile;
 class cmRulePlaceholderExpander;
-class cmSourceFile;
 class cmake;
 
 /**
@@ -74,10 +73,6 @@ public:
   void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
                                cmNinjaDeps& ninjaDeps);
 
-  void ComputeObjectFilenames(
-    std::map<cmSourceFile const*, std::string>& mapping,
-    cmGeneratorTarget const* gt = nullptr) override;
-
 protected:
   std::string ConvertToIncludeReference(
     std::string const& path,
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index ff3fcfd..12682a7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -150,20 +150,6 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
   }
 }
 
-void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
-  std::map<cmSourceFile const*, std::string>& mapping,
-  cmGeneratorTarget const* gt)
-{
-  // Determine if these object files should use a custom extension
-  char const* custom_ext = gt->GetCustomObjectExtension();
-  for (auto& si : mapping) {
-    cmSourceFile const* sf = si.first;
-    bool keptSourceExtension;
-    si.second = this->GetObjectFileNameWithoutTarget(
-      *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext);
-  }
-}
-
 void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
   std::map<std::string, LocalObjectInfo>& localObjectFiles)
 {
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 86c5aab..2d580d5 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -19,7 +19,6 @@ class cmCustomCommandGenerator;
 class cmGeneratorTarget;
 class cmGlobalGenerator;
 class cmMakefile;
-class cmSourceFile;
 
 /** \class cmLocalUnixMakefileGenerator3
  * \brief Write a LocalUnix makefiles.
@@ -252,10 +251,6 @@ protected:
 private:
   std::string MaybeConvertWatcomShellCommand(std::string const& cmd);
 
-  void ComputeObjectFilenames(
-    std::map<cmSourceFile const*, std::string>& mapping,
-    cmGeneratorTarget const* gt = nullptr) override;
-
   friend class cmMakefileTargetGenerator;
   friend class cmMakefileExecutableTargetGenerator;
   friend class cmMakefileLibraryTargetGenerator;

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

Summary of changes:
 Modules/CMakeDetermineASMCompiler.cmake    |    4 +
 Modules/CheckIPOSupported.cmake            |    2 +-
 Modules/FindCUDA.cmake                     |   12 ++
 Source/cmLocalCommonGenerator.cxx          |   15 ++
 Source/cmLocalCommonGenerator.h            |    6 +
 Source/cmLocalGenerator.cxx                |   28 +---
 Source/cmLocalGenerator.h                  |    7 +-
 Source/cmLocalNinjaGenerator.cxx           |   14 --
 Source/cmLocalNinjaGenerator.h             |    5 -
 Source/cmLocalUnixMakefileGenerator3.cxx   |   14 --
 Source/cmLocalUnixMakefileGenerator3.h     |    5 -
 Source/cmSourceGroupCommand.cxx            |  224 +++++++++++++++++-----------
 Source/cmSourceGroupCommand.h              |   23 ++-
 Source/cmVisualStudio10TargetGenerator.cxx |    4 +-
 Tests/SourceGroups/CMakeLists.txt          |   10 +-
 Tests/SourceGroups/main.c                  |    7 +-
 Tests/SourceGroups/tree_empty_prefix_bar.c |    4 +
 Tests/SourceGroups/tree_empty_prefix_foo.c |    4 +
 18 files changed, 227 insertions(+), 161 deletions(-)
 create mode 100644 Tests/SourceGroups/tree_empty_prefix_bar.c
 create mode 100644 Tests/SourceGroups/tree_empty_prefix_foo.c


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list