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  b76b83efd37a439e22d1d92af3b98c30e8f9ba97 (commit)
       via  e0fbb7bf0843615e805ec325432d0c6d2ef9a30e (commit)
       via  c2f6da3399efa1448eadbae65311795ced3f8930 (commit)
       via  a84e509844b74d445b654cd9d0be98a8f0e0641e (commit)
       via  d59159afdb630734213a120334f394331ef18504 (commit)
       via  0281f9a4cad6e189601a87c9ccfba8c54e71e14b (commit)
      from  b38023f958325fedd99d5480149f4958e721fdd5 (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=b76b83efd37a439e22d1d92af3b98c30e8f9ba97
commit b76b83efd37a439e22d1d92af3b98c30e8f9ba97
Merge: e0fbb7b d59159a
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Feb 20 14:05:50 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Feb 20 09:05:57 2019 -0500

    Merge topic 'cray-cleanup'
    
    d59159afdb Cray: clean up CrayPrgEnv and CrayLinuxEnvironment modules
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !2945


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0fbb7bf0843615e805ec325432d0c6d2ef9a30e
commit e0fbb7bf0843615e805ec325432d0c6d2ef9a30e
Merge: c2f6da3 a84e509
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Feb 20 14:04:48 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Feb 20 09:04:58 2019 -0500

    Merge topic 'list-prepend-and-pop-subcommands'
    
    a84e509844 list: add sub-commands PREPEND, POP_BACK, POP_FRONT
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !2980


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2f6da3399efa1448eadbae65311795ced3f8930
commit c2f6da3399efa1448eadbae65311795ced3f8930
Merge: b38023f 0281f9a
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Feb 20 14:01:44 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Feb 20 09:03:48 2019 -0500

    Merge topic 'configurefile-stdstring'
    
    0281f9a4ca cmMakefile::ConfigureFile: Accept `std::string` parameters
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !2982


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a84e509844b74d445b654cd9d0be98a8f0e0641e
commit a84e509844b74d445b654cd9d0be98a8f0e0641e
Author:     Alex Turbov <i.za...@gmail.com>
AuthorDate: Mon Feb 18 00:47:50 2019 +0800
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Feb 19 09:42:36 2019 -0500

    list: add sub-commands PREPEND, POP_BACK, POP_FRONT

diff --git a/Help/command/list.rst b/Help/command/list.rst
index bfcdf34..6c86c2a 100644
--- a/Help/command/list.rst
+++ b/Help/command/list.rst
@@ -21,6 +21,9 @@ Synopsis
     list(`APPEND`_ <list> [<element>...])
     list(`FILTER`_ <list> {INCLUDE | EXCLUDE} REGEX <regex>)
     list(`INSERT`_ <list> <index> [<element>...])
+    list(`POP_BACK`_ <list> [<out-var>...])
+    list(`POP_FRONT`_ <list> [<out-var>...])
+    list(`PREPEND`_ <list> [<element>...])
     list(`REMOVE_ITEM`_ <list> <value>...)
     list(`REMOVE_AT`_ <list> <index>...)
     list(`REMOVE_DUPLICATES`_ <list>)
@@ -33,8 +36,9 @@ Synopsis
 Introduction
 ^^^^^^^^^^^^
 
-The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``,
-``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
+The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``PREPEND``,
+``POP_BACK``, ``POP_FRONT``, ``REMOVE_AT``, ``REMOVE_ITEM``,
+``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create
 new values for the list within the current CMake variable scope.  Similar to
 the :command:`set` command, the LIST command creates new variable values in
 the current scope, even if the list itself is actually defined in a parent
@@ -142,6 +146,34 @@ For more information on regular expressions see also the
 
 Inserts elements to the list to the specified location.
 
+.. _POP_BACK:
+
+.. code-block:: cmake
+
+  list(POP_BACK <list> [<out-var>...])
+
+If no variable name is given, removes exactly one element. Otherwise,
+assign the last element's value to the given variable and removes it,
+up to the last variable name given.
+
+.. _POP_FRONT:
+
+.. code-block:: cmake
+
+  list(POP_FRONT <list> [<out-var>...])
+
+If no variable name is given, removes exactly one element. Otherwise,
+assign the first element's value to the given variable and removes it,
+up to the last variable name given.
+
+.. _PREPEND:
+
+.. code-block:: cmake
+
+  list(PREPEND <list> [<element> ...])
+
+Insert elements to the 0th position in the list.
+
 .. _REMOVE_ITEM:
 
 .. code-block:: cmake
diff --git a/Help/release/dev/list-prepend-and-pop-subcommands.rst 
b/Help/release/dev/list-prepend-and-pop-subcommands.rst
new file mode 100644
index 0000000..16b14f1
--- /dev/null
+++ b/Help/release/dev/list-prepend-and-pop-subcommands.rst
@@ -0,0 +1,4 @@
+list-prepend-and-pop-subcommands
+--------------------------------
+
+* :command:`list` learned new sub-commands ``PREPEND``, ``POP_FRONT`` and 
``POP_BACK``.
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 297babf..fdbd5ba 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -42,6 +42,15 @@ bool cmListCommand::InitialPass(std::vector<std::string> 
const& args,
   if (subCommand == "APPEND") {
     return this->HandleAppendCommand(args);
   }
+  if (subCommand == "PREPEND") {
+    return this->HandlePrependCommand(args);
+  }
+  if (subCommand == "POP_BACK") {
+    return this->HandlePopBackCommand(args);
+  }
+  if (subCommand == "POP_FRONT") {
+    return this->HandlePopFrontCommand(args);
+  }
   if (subCommand == "FIND") {
     return this->HandleFindCommand(args);
   }
@@ -222,20 +231,141 @@ bool 
cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
     return true;
   }
 
-  const std::string& listName = args[1];
+  std::string const& listName = args[1];
   // expand the variable
   std::string listString;
   this->GetListString(listString, listName);
 
-  if (!listString.empty() && !args.empty()) {
-    listString += ";";
+  // If `listString` or `args` is empty, no need to append `;`,
+  // then index is going to be `1` and points to the end-of-string ";"
+  auto const offset =
+    std::string::size_type(listString.empty() || args.empty());
+  listString += &";"[offset] + cmJoin(cmMakeRange(args).advance(2), ";");
+
+  this->Makefile->AddDefinition(listName, listString.c_str());
+  return true;
+}
+
+bool cmListCommand::HandlePrependCommand(std::vector<std::string> const& args)
+{
+  assert(args.size() >= 2);
+
+  // Skip if nothing to prepend.
+  if (args.size() < 3) {
+    return true;
   }
-  listString += cmJoin(cmMakeRange(args).advance(2), ";");
+
+  std::string const& listName = args[1];
+  // expand the variable
+  std::string listString;
+  this->GetListString(listString, listName);
+
+  // If `listString` or `args` is empty, no need to append `;`,
+  // then `offset` is going to be `1` and points to the end-of-string ";"
+  auto const offset =
+    std::string::size_type(listString.empty() || args.empty());
+  listString.insert(0,
+                    cmJoin(cmMakeRange(args).advance(2), ";") + &";"[offset]);
 
   this->Makefile->AddDefinition(listName, listString.c_str());
   return true;
 }
 
+bool cmListCommand::HandlePopBackCommand(std::vector<std::string> const& args)
+{
+  assert(args.size() >= 2);
+
+  auto ai = args.cbegin();
+  ++ai; // Skip subcommand name
+  std::string const& listName = *ai++;
+  std::vector<std::string> varArgsExpanded;
+  if (!this->GetList(varArgsExpanded, listName)) {
+    // Can't get the list definition... undefine any vars given after.
+    for (; ai != args.cend(); ++ai) {
+      this->Makefile->RemoveDefinition(*ai);
+    }
+    return true;
+  }
+
+  if (!varArgsExpanded.empty()) {
+    if (ai == args.cend()) {
+      // No variables are given... Just remove one element.
+      varArgsExpanded.pop_back();
+    } else {
+      // Ok, assign elements to be removed to the given variables
+      for (; !varArgsExpanded.empty() && ai != args.cend(); ++ai) {
+        assert(!ai->empty());
+        this->Makefile->AddDefinition(*ai, varArgsExpanded.back().c_str());
+        varArgsExpanded.pop_back();
+      }
+      // Undefine the rest variables if the list gets empty earlier...
+      for (; ai != args.cend(); ++ai) {
+        this->Makefile->RemoveDefinition(*ai);
+      }
+    }
+
+    this->Makefile->AddDefinition(listName,
+                                  cmJoin(varArgsExpanded, ";").c_str());
+
+  } else if (ai !=
+             args.cend()) { // The list is empty, but some args were given
+    // Need to *undefine* 'em all, cuz there are no items to assign...
+    for (; ai != args.cend(); ++ai) {
+      this->Makefile->RemoveDefinition(*ai);
+    }
+  }
+
+  return true;
+}
+
+bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args)
+{
+  assert(args.size() >= 2);
+
+  auto ai = args.cbegin();
+  ++ai; // Skip subcommand name
+  std::string const& listName = *ai++;
+  std::vector<std::string> varArgsExpanded;
+  if (!this->GetList(varArgsExpanded, listName)) {
+    // Can't get the list definition... undefine any vars given after.
+    for (; ai != args.cend(); ++ai) {
+      this->Makefile->RemoveDefinition(*ai);
+    }
+    return true;
+  }
+
+  if (!varArgsExpanded.empty()) {
+    if (ai == args.cend()) {
+      // No variables are given... Just remove one element.
+      varArgsExpanded.erase(varArgsExpanded.begin());
+    } else {
+      // Ok, assign elements to be removed to the given variables
+      auto vi = varArgsExpanded.begin();
+      for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) {
+        assert(!ai->empty());
+        this->Makefile->AddDefinition(*ai, varArgsExpanded.front().c_str());
+      }
+      varArgsExpanded.erase(varArgsExpanded.begin(), vi);
+      // Undefine the rest variables if the list gets empty earlier...
+      for (; ai != args.cend(); ++ai) {
+        this->Makefile->RemoveDefinition(*ai);
+      }
+    }
+
+    this->Makefile->AddDefinition(listName,
+                                  cmJoin(varArgsExpanded, ";").c_str());
+
+  } else if (ai !=
+             args.cend()) { // The list is empty, but some args were given
+    // Need to *undefine* 'em all, cuz there are no items to assign...
+    for (; ai != args.cend(); ++ai) {
+      this->Makefile->RemoveDefinition(*ai);
+    }
+  }
+
+  return true;
+}
+
 bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args)
 {
   if (args.size() != 4) {
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 76a9856..ea3d643 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -35,6 +35,9 @@ protected:
   bool HandleLengthCommand(std::vector<std::string> const& args);
   bool HandleGetCommand(std::vector<std::string> const& args);
   bool HandleAppendCommand(std::vector<std::string> const& args);
+  bool HandlePrependCommand(std::vector<std::string> const& args);
+  bool HandlePopBackCommand(std::vector<std::string> const& args);
+  bool HandlePopFrontCommand(std::vector<std::string> const& args);
   bool HandleFindCommand(std::vector<std::string> const& args);
   bool HandleInsertCommand(std::vector<std::string> const& args);
   bool HandleJoinCommand(std::vector<std::string> const& args);
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt 
b/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt 
b/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/POP_BACK-NoArgs.cmake 
b/Tests/RunCMake/list/POP_BACK-NoArgs.cmake
new file mode 100644
index 0000000..518924d
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK-NoArgs.cmake
@@ -0,0 +1 @@
+list(POP_FRONT)
diff --git a/Tests/RunCMake/list/POP_BACK.cmake 
b/Tests/RunCMake/list/POP_BACK.cmake
new file mode 100644
index 0000000..4794796
--- /dev/null
+++ b/Tests/RunCMake/list/POP_BACK.cmake
@@ -0,0 +1,79 @@
+cmake_policy(SET CMP0054 NEW)
+
+function(assert_expected_list_len list_var expected_size)
+    list(LENGTH ${list_var} _size)
+    if(NOT _size EQUAL ${expected_size})
+        message(FATAL_ERROR "list size expected to be `${expected_size}`, got 
`${_size}` instead")
+    endif()
+endfunction()
+
+# Pop from undefined list
+list(POP_BACK test)
+if(DEFINED test)
+    message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Pop from empty list
+set(test)
+list(POP_BACK test)
+if(DEFINED test)
+    message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Default pop from 1-item list
+list(APPEND test one)
+list(POP_BACK test)
+assert_expected_list_len(test 0)
+
+# Pop from 1-item list to var
+list(APPEND test one)
+list(POP_BACK test one)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+    message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+    message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+
+unset(one)
+unset(two)
+
+# Pop from 1-item list to vars
+list(APPEND test one)
+list(POP_BACK test one two)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+    message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+    message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(DEFINED two)
+    message(FATAL_ERROR "`two` expected to be undefined")
+endif()
+
+unset(one)
+unset(two)
+
+# Default pop from 2-item list
+list(APPEND test one two)
+list(POP_BACK test)
+assert_expected_list_len(test 1)
+if(NOT test STREQUAL "one")
+    message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
+
+# Pop from 2-item list
+list(APPEND test two)
+list(POP_BACK test two)
+assert_expected_list_len(test 1)
+if(NOT DEFINED two)
+    message(FATAL_ERROR "`two` expected to be defined")
+endif()
+if(NOT two STREQUAL "two")
+    message(FATAL_ERROR "`two` has unexpected value `${two}`")
+endif()
+if(NOT test STREQUAL "one")
+    message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt 
b/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt 
b/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake 
b/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake
new file mode 100644
index 0000000..c5cf837
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT-NoArgs.cmake
@@ -0,0 +1 @@
+list(POP_BACK)
diff --git a/Tests/RunCMake/list/POP_FRONT.cmake 
b/Tests/RunCMake/list/POP_FRONT.cmake
new file mode 100644
index 0000000..a2f8f3c
--- /dev/null
+++ b/Tests/RunCMake/list/POP_FRONT.cmake
@@ -0,0 +1,79 @@
+cmake_policy(SET CMP0054 NEW)
+
+function(assert_expected_list_len list_var expected_size)
+    list(LENGTH ${list_var} _size)
+    if(NOT _size EQUAL ${expected_size})
+        message(FATAL_ERROR "list size expected to be `${expected_size}`, got 
`${_size}` instead")
+    endif()
+endfunction()
+
+# Pop from undefined list
+list(POP_FRONT test)
+if(DEFINED test)
+    message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Pop from empty list
+set(test)
+list(POP_FRONT test)
+if(DEFINED test)
+    message(FATAL_ERROR "`test` expected to be undefined")
+endif()
+
+# Default pop from 1-item list
+list(APPEND test one)
+list(POP_FRONT test)
+assert_expected_list_len(test 0)
+
+# Pop from 1-item list to var
+list(APPEND test one)
+list(POP_FRONT test one)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+    message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+    message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+
+unset(one)
+unset(two)
+
+# Pop from 1-item list to vars
+list(APPEND test one)
+list(POP_FRONT test one two)
+assert_expected_list_len(test 0)
+if(NOT DEFINED one)
+    message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+    message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(DEFINED two)
+    message(FATAL_ERROR "`two` expected to be undefined")
+endif()
+
+unset(one)
+unset(two)
+
+# Default pop from 2-item list
+list(APPEND test one two)
+list(POP_FRONT test)
+assert_expected_list_len(test 1)
+if(NOT test STREQUAL "two")
+    message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
+
+# Pop from 2-item list
+list(PREPEND test one)
+list(POP_FRONT test one)
+assert_expected_list_len(test 1)
+if(NOT DEFINED one)
+    message(FATAL_ERROR "`one` expected to be defined")
+endif()
+if(NOT one STREQUAL "one")
+    message(FATAL_ERROR "`one` has unexpected value `${one}`")
+endif()
+if(NOT test STREQUAL "two")
+    message(FATAL_ERROR "`test` has unexpected value `${test}`")
+endif()
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs-result.txt 
b/Tests/RunCMake/list/PREPEND-NoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt 
b/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt
new file mode 100644
index 0000000..83060b4
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt
@@ -0,0 +1 @@
+list must be called with at least two arguments
diff --git a/Tests/RunCMake/list/PREPEND-NoArgs.cmake 
b/Tests/RunCMake/list/PREPEND-NoArgs.cmake
new file mode 100644
index 0000000..8935fa9
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND-NoArgs.cmake
@@ -0,0 +1 @@
+list(PREPEND)
diff --git a/Tests/RunCMake/list/PREPEND.cmake 
b/Tests/RunCMake/list/PREPEND.cmake
new file mode 100644
index 0000000..17b2921
--- /dev/null
+++ b/Tests/RunCMake/list/PREPEND.cmake
@@ -0,0 +1,33 @@
+list(PREPEND test)
+if(test)
+    message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test satu)
+if(NOT test STREQUAL "satu")
+    message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test dua)
+if(NOT test STREQUAL "dua;satu")
+    message(FATAL_ERROR "failed")
+endif()
+
+list(PREPEND test tiga)
+if(NOT test STREQUAL "tiga;dua;satu")
+    message(FATAL_ERROR "failed")
+endif()
+
+# Scope test
+function(foo)
+    list(PREPEND test empat)
+    if(NOT test STREQUAL "empat;tiga;dua;satu")
+        message(FATAL_ERROR "failed")
+    endif()
+endfunction()
+
+foo()
+
+if(NOT test STREQUAL "tiga;dua;satu")
+    message(FATAL_ERROR "failed")
+endif()
diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake 
b/Tests/RunCMake/list/RunCMakeTest.cmake
index bf3d22d..59c7ea5 100644
--- a/Tests/RunCMake/list/RunCMakeTest.cmake
+++ b/Tests/RunCMake/list/RunCMakeTest.cmake
@@ -98,3 +98,15 @@ run_cmake(SORT-NoCaseOption)
 
 # Successful tests
 run_cmake(SORT)
+
+# argument tests
+run_cmake(PREPEND-NoArgs)
+# Successful tests
+run_cmake(PREPEND)
+
+# argument tests
+run_cmake(POP_BACK-NoArgs)
+run_cmake(POP_FRONT-NoArgs)
+# Successful tests
+run_cmake(POP_BACK)
+run_cmake(POP_FRONT)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d59159afdb630734213a120334f394331ef18504
commit d59159afdb630734213a120334f394331ef18504
Author:     Chuck Cranor <ch...@ece.cmu.edu>
AuthorDate: Fri Feb 8 14:14:48 2019 -0700
Commit:     Chuck Cranor <ch...@ece.cmu.edu>
CommitDate: Tue Feb 19 06:50:22 2019 -0700

    Cray: clean up CrayPrgEnv and CrayLinuxEnvironment modules
    
    CrayPrgEnv:
      - add a new function __cmake_craype_linktype() that determines what
        link mode the Cray compiler wrapper will use in a more sophisticated
        way than just MATCHing for static/dynamic on the command line.
    
      - add a new function __cmake_craype_setupenv() that does a
        once-per-cmake-run setup that does the following:
           1. does a basic check of the wrapper's configuration.  Running
              cmake and then changing module and/or linktype configuration
              may cause build problems (since the data in the cmake cache
              may no longer be correct after the change).  We look for this
              and warn the user about it.
           2. uses the "module" provided PKG_CONFIG_PATH environment variable
              to add additional prefixes to the system prefix path.  This
              function used to be done by CrayLinuxEnvironment using the
              compiler implicit include/link paths but that is intended
              only for cross-compiling on Cray front-end nodes.  Since
              CrayPrgEnv runs on both front-end and compute nodes, we
              migrate this function here.
    
    CrayLinuxEnvironment:
      - No need to set variables like CMAKE_SHARED_LIBRARY_PREFIX to values
        that have already been properly established by CMakeGenericSystem.cmake.
        Remove redundant sets of CMAKE_SHARED_LIBRARY_PREFIX,
        CMAKE_SHARED_LIBRARY_SUFFIX, CMAKE_STATIC_LIBRARY_PREFIX,
        CMAKE_STATIC_LIBRARY_SUFFIX, CMAKE_FIND_LIBRARY_PREFIXES, and
        CMAKE_DL_LIBS.
    
      - No need to add $ENV{SYSROOT_DIR}/usr/include to 
CMAKE_SYSTEM_INCLUDE_PATH
        when we already added $ENV{SYSROOT_DIR}/usr to CMAKE_SYSTEM_PREFIX_PATH.
    
      - Remove __cray_list_intersect(), __list_clean_dupes(), and buggy
        code that adds compiler implicit includes/libs to
        CMAKE_SYSTEM_INCLUDE_PATH and CMAKE_SYSTEM_LIBRARY_PATH.  This
        function has migrated to CrayPrgEnv.cmake, as noted above.
    
    See discussion in issue #17413 for additional details.

diff --git a/Modules/Compiler/CrayPrgEnv.cmake 
b/Modules/Compiler/CrayPrgEnv.cmake
index 6c1c770..e55e587 100644
--- a/Modules/Compiler/CrayPrgEnv.cmake
+++ b/Modules/Compiler/CrayPrgEnv.cmake
@@ -1,8 +1,93 @@
 # Guard against multiple inclusions
-if(__craylinux_crayprgenv)
+if(__cmake_craype_crayprgenv)
   return()
 endif()
-set(__craylinux_crayprgenv 1)
+set(__cmake_craype_crayprgenv 1)
+
+# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper.
+# The compiler wrapper can run on a front-end node or a compute node.
+
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW)  # if IN_LIST
+
+# One-time setup of the craype environment.  First, check the wrapper config.
+# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and
+# default include/library paths is selected using the "module" command.
+# The CRAYPE_LINK_TYPE environment variable partly controls if static
+# or dynamic binaries are generated (see __cmake_craype_linktype below).
+# Running cmake and then changing module and/or linktype configuration
+# may cause build problems (since the data in the cmake cache may no
+# longer be correct after the change).  We can look for this and warn
+# the user about it.  Second, use the "module" provided PKG_CONFIG_PATH-like
+# environment variable to add additional prefixes to the system prefix
+# path.
+function(__cmake_craype_setupenv)
+  if(NOT DEFINED __cmake_craype_setupenv_done)  # only done once per run
+    set(__cmake_craype_setupenv_done 1 PARENT_SCOPE)
+    unset(__cmake_check)
+    set(CMAKE_CRAYPE_LINKTYPE "$ENV{CRAYPE_LINK_TYPE}" CACHE STRING
+        "saved value of CRAYPE_LINK_TYPE environment variable")
+    set(CMAKE_CRAYPE_LOADEDMODULES "$ENV{LOADEDMODULES}" CACHE STRING
+        "saved value of LOADEDMODULES environment variable")
+    mark_as_advanced(CMAKE_CRAYPE_LINKTYPE CMAKE_CRAYPE_LOADEDMODULES)
+    if (NOT "${CMAKE_CRAYPE_LINKTYPE}" STREQUAL "$ENV{CRAYPE_LINK_TYPE}")
+      string(APPEND __cmake_check "CRAYPE_LINK_TYPE ")
+    endif()
+    if (NOT "${CMAKE_CRAYPE_LOADEDMODULES}" STREQUAL "$ENV{LOADEDMODULES}")
+      string(APPEND __cmake_check "LOADEDMODULES ")
+    endif()
+    if(DEFINED __cmake_check)
+      message(STATUS "NOTE: ${__cmake_check}changed since initial config!")
+      message(STATUS "NOTE: this may cause unexpected build errors.")
+    endif()
+    # loop over variables of interest
+    foreach(pkgcfgvar PKG_CONFIG_PATH PKG_CONFIG_PATH_DEFAULT
+            PE_PKG_CONFIG_PATH)
+      file(TO_CMAKE_PATH "$ENV{${pkgcfgvar}}" pkgcfg)
+      foreach(path ${pkgcfg})
+        string(REGEX REPLACE "(.*)/lib[^/]*/pkgconfig$" "\\1" path "${path}")
+        if(NOT "${path}" STREQUAL "" AND
+           NOT "${path}" IN_LIST CMAKE_SYSTEM_PREFIX_PATH)
+          list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${path}")
+        endif()
+      endforeach()
+    endforeach()
+    # push it up out of this function into the parent scope
+    set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
+  endif()
+endfunction()
+
+# The wrapper disables dynamic linking by default.  Dynamic linking is
+# enabled either by setting $ENV{CRAYPE_LINK_TYPE} to "dynamic" or by
+# specifying "-dynamic" to the wrapper when linking.  Specifying "-static"
+# to the wrapper when linking takes priority over $ENV{CRAYPE_LINK_TYPE}.
+# Furthermore, if you specify multiple "-dynamic" and "-static" flags to
+# the wrapper when linking, the last one will win.  In this case, the
+# wrapper will also print a warning like:
+#  Warning: -dynamic was already seen on command line, overriding with -static.
+#
+# note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS
+# (in that order) to the linking command, so -dynamic can appear in either
+# variable.
+function(__cmake_craype_linktype lang rv)
+  # start with ENV, but allow flags to override
+  if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic")
+    set(linktype dynamic)
+  else()
+    set(linktype static)
+  endif()
+  # combine flags and convert to a list so we can apply the flags in order
+  set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
+  string(REPLACE " " ";" linkflags "${linkflags}")
+  foreach(flag IN LISTS linkflags)
+    if("${flag}" STREQUAL "-dynamic")
+      set(linktype dynamic)
+    elseif("${flag}" STREQUAL "-static")
+      set(linktype static)
+    endif()
+  endforeach()
+  set(${rv} ${linktype} PARENT_SCOPE)
+endfunction()
 
 macro(__CrayPrgEnv_setup lang)
   if(DEFINED ENV{CRAYPE_VERSION})
@@ -13,25 +98,25 @@ macro(__CrayPrgEnv_setup lang)
     message(STATUS "Cray Programming Environment (unknown version) ${lang}")
   endif()
 
+  # setup the craype environment
+  __cmake_craype_setupenv()
+
   # Flags for the Cray wrappers
   set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static")
   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
   set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic")
 
-  # If the link type is not explicitly specified in the environment then
-  # the Cray wrappers assume that the code will be built statically so
-  # we check the following condition(s) are NOT met
-  #  Compiler flags are explicitly dynamic
-  #  Env var is dynamic and compiler flags are not explicitly static
-  if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR
-         (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )"))
-         OR
-         (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND
-          NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR
-               (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )")))))
+  # determine linktype from environment and compiler flags
+  __cmake_craype_linktype(${lang} __cmake_craype_${lang}_linktype)
+
+  # switch off shared libs if we get a static linktype
+  if("${__cmake_craype_${lang}_linktype}" STREQUAL "static")
     set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
     set(BUILD_SHARED_LIBS FALSE CACHE BOOL "")
     set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
     set(CMAKE_LINK_SEARCH_START_STATIC TRUE)
   endif()
+
 endmacro()
+
+cmake_policy(POP)
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake 
b/Modules/Platform/CrayLinuxEnvironment.cmake
index a1a3d3f..f2aaf3f 100644
--- a/Modules/Platform/CrayLinuxEnvironment.cmake
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -1,6 +1,5 @@
-# Compute Node Linux doesn't quite work the same as native Linux so all of this
-# needs to be custom.  We use the variables defined through Cray's environment
-# modules to set up the right paths for things.
+# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end
+# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake
 
 set(UNIX 1)
 
@@ -30,13 +29,6 @@ endif()
 # Note: this may need to change in the future with 64-bit ARM
 set(CMAKE_SYSTEM_PROCESSOR "x86_64")
 
-set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
-set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
-set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
-set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
-
-set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
-
 # Don't override shared lib support if it's already been set and possibly
 # overridden elsewhere by the CrayPrgEnv module
 if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
@@ -44,12 +36,9 @@ if(NOT CMAKE_FIND_LIBRARY_SUFFIXES)
   set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
 endif()
 
-set(CMAKE_DL_LIBS dl)
+# The rest of this file is based on UnixPaths.cmake, adjusted for Cray
 
-# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray
-# environment accordingly
-
-# Get the install directory of the running cmake to the search directories
+# add the install directory of the running cmake to the search directories
 # CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels 
up
 get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH)
 get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH)
@@ -81,7 +70,6 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX)
 endif()
 
 list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
-  $ENV{SYSROOT_DIR}/usr/include
   $ENV{SYSROOT_DIR}/usr/include/X11
 )
 list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
@@ -95,57 +83,5 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
   $ENV{SYSROOT_DIR}/lib64
 )
 
-# Compute the intersection of several lists
-function(__cray_list_intersect OUTPUT INPUT0)
-  if(ARGC EQUAL 2)
-    list(APPEND ${OUTPUT} ${${INPUT0}})
-  else()
-    foreach(I IN LISTS ${INPUT0})
-      set(__is_common 1)
-      foreach(L IN LISTS ARGN)
-        list(FIND ${L} "${I}" __idx)
-        if(__idx EQUAL -1)
-          set(__is_common 0)
-          break()
-        endif()
-      endforeach()
-      if(__is_common)
-        list(APPEND ${OUTPUT}  "${I}")
-      endif()
-    endforeach()
-  endif()
-  set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE)
-endfunction()
-
-macro(__list_clean_dupes var)
-  if(${var})
-    list(REMOVE_DUPLICATES ${var})
-  endif()
-endmacro()
-
-get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
-set(__cray_inc_path_vars)
-set(__cray_lib_path_vars)
-foreach(__lang IN LISTS __langs)
-  list(APPEND __cray_inc_path_vars 
CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES)
-  list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES)
-endforeach()
-if(__cray_inc_path_vars)
-  __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars})
-  if(__cray_implicit_include_dirs)
-    list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs})
-  endif()
-endif()
-if(__cray_lib_path_vars)
-  __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars})
-  if(__cray_implicit_library_dirs)
-    list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs})
-  endif()
-endif()
-__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH)
-__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH)
-__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH)
-__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES)
-
 # Enable use of lib64 search path variants by default.
 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0281f9a4cad6e189601a87c9ccfba8c54e71e14b
commit 0281f9a4cad6e189601a87c9ccfba8c54e71e14b
Author:     Vitaly Stakhovsky <vvs31...@gitlab.org>
AuthorDate: Mon Feb 18 09:54:51 2019 -0500
Commit:     Vitaly Stakhovsky <vvs31...@gitlab.org>
CommitDate: Mon Feb 18 20:48:19 2019 -0500

    cmMakefile::ConfigureFile: Accept `std::string` parameters

diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx 
b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index f522ce2..045d93d 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -618,7 +618,7 @@ bool 
cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
 
   std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
 
-  if (!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath.c_str())) {
+  if (!ConfigureFile(wixTemplate, mainSourceFilePath)) {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
                   "Failed creating '" << mainSourceFilePath
                                       << "'' from template." << std::endl);
diff --git a/Source/CPack/cmCPackGenerator.cxx 
b/Source/CPack/cmCPackGenerator.cxx
index fc34ef8..575254e 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1245,7 +1245,8 @@ bool cmCPackGenerator::ConfigureString(const std::string& 
inString,
   return true;
 }
 
-bool cmCPackGenerator::ConfigureFile(const char* inName, const char* outName,
+bool cmCPackGenerator::ConfigureFile(const std::string& inName,
+                                     const std::string& outName,
                                      bool copyOnly /* = false */)
 {
   return this->MakefileMap->ConfigureFile(inName, outName, copyOnly, true,
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 9e4bf43..3c06d41 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -169,7 +169,8 @@ protected:
   virtual const char* GetPackagingInstallPrefix();
 
   virtual std::string FindTemplate(const char* name);
-  virtual bool ConfigureFile(const char* inName, const char* outName,
+  virtual bool ConfigureFile(const std::string& inName,
+                             const std::string& outName,
                              bool copyOnly = false);
   virtual bool ConfigureString(const std::string& input, std::string& output);
   virtual int InitializeInternal();
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx 
b/Source/CPack/cmCPackNSISGenerator.cxx
index c77eebc..6afd7d5 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -292,9 +292,8 @@ int cmCPackNSISGenerator::PackageFiles()
     this->SetOption("CPACK_NSIS_DEFINES", defines.c_str());
   }
 
-  this->ConfigureFile(nsisInInstallOptions.c_str(),
-                      nsisInstallOptions.c_str());
-  this->ConfigureFile(nsisInFileName.c_str(), nsisFileName.c_str());
+  this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions);
+  this->ConfigureFile(nsisInFileName, nsisFileName);
   std::string nsisCmd = "\"";
   nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM");
   nsisCmd += "\" \"" + nsisFileName + "\"";
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx 
b/Source/CPack/cmCPackOSXX11Generator.cxx
index 85248c6..90e0afe 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -83,7 +83,7 @@ int cmCPackOSXX11Generator::PackageFiles()
       return 0;
     }
     std::string destFileName = resourcesDirectory + "/" + iconFileName;
-    this->ConfigureFile(iconFile, destFileName.c_str(), true);
+    this->ConfigureFile(iconFile, destFileName, true);
     this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName.c_str());
   }
 
@@ -236,7 +236,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const 
std::string& name)
   cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: "
                 << (inFileName ? inFileName : "(NULL)")
                 << " to " << destFileName << std::endl);
-  this->ConfigureFile(inFileName, destFileName.c_str());
+  this->ConfigureFile(inFileName, destFileName);
   return true;
 }
 */
@@ -266,7 +266,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(
   cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                 "Configure file: " << inFileName << " to " << destFileName
                                    << std::endl);
-  this->ConfigureFile(inFileName.c_str(), destFileName.c_str(), copyOnly);
+  this->ConfigureFile(inFileName, destFileName, copyOnly);
   return true;
 }
 
diff --git a/Source/CPack/cmCPackPKGGenerator.cxx 
b/Source/CPack/cmCPackPKGGenerator.cxx
index d54ab56..8c22c65 100644
--- a/Source/CPack/cmCPackPKGGenerator.cxx
+++ b/Source/CPack/cmCPackPKGGenerator.cxx
@@ -105,7 +105,7 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* 
metapackageFile)
 
   // Create the distribution.dist file in the metapackage to turn it
   // into a distribution package.
-  this->ConfigureFile(distributionTemplate.c_str(), distributionFile.c_str());
+  this->ConfigureFile(distributionTemplate, distributionFile);
 }
 
 void cmCPackPKGGenerator::CreateChoiceOutline(
@@ -294,7 +294,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const 
std::string& name,
   cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                 "Configure file: " << (inFileName ? inFileName : "(NULL)")
                                    << " to " << destFileName << std::endl);
-  this->ConfigureFile(inFileName, destFileName.c_str());
+  this->ConfigureFile(inFileName, destFileName);
   return true;
 }
 
@@ -322,7 +322,7 @@ bool cmCPackPKGGenerator::CopyResourcePlistFile(const 
std::string& name,
   cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                 "Configure file: " << inFileName << " to " << destFileName
                                    << std::endl);
-  this->ConfigureFile(inFileName.c_str(), destFileName.c_str());
+  this->ConfigureFile(inFileName, destFileName);
   return true;
 }
 
diff --git a/Source/cmConfigureFileCommand.cxx 
b/Source/cmConfigureFileCommand.cxx
index 8224a0f..0917d11 100644
--- a/Source/cmConfigureFileCommand.cxx
+++ b/Source/cmConfigureFileCommand.cxx
@@ -102,7 +102,7 @@ bool 
cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args,
 
 int cmConfigureFileCommand::ConfigureFile()
 {
-  return this->Makefile->ConfigureFile(
-    this->InputFile.c_str(), this->OutputFile.c_str(), this->CopyOnly,
-    this->AtOnly, this->EscapeQuotes, this->NewLineStyle);
+  return this->Makefile->ConfigureFile(this->InputFile, this->OutputFile,
+                                       this->CopyOnly, this->AtOnly,
+                                       this->EscapeQuotes, this->NewLineStyle);
 }
diff --git a/Source/cmCreateTestSourceList.cxx 
b/Source/cmCreateTestSourceList.cxx
index 69532e6..b78493f 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -136,8 +136,7 @@ bool 
cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args,
   this->Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES",
                                 functionMapCode.c_str());
   bool res = true;
-  if (!this->Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false,
-                                     true, false)) {
+  if (!this->Makefile->ConfigureFile(configFile, driver, false, true, false)) {
     res = false;
   }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index 51c001e..68de8ae 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2002,7 +2002,7 @@ void 
cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
         // so let it replace the framework name. This avoids creating
         // a per-configuration Info.plist file.
         this->CurrentLocalGenerator->GenerateFrameworkInfoPList(
-          gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+          gtgt, "$(EXECUTABLE_NAME)", plist);
         buildSettings->AddAttribute("INFOPLIST_FILE",
                                     this->CreateString(plist));
         buildSettings->AddAttribute("MACH_O_TYPE",
@@ -2043,7 +2043,7 @@ void 
cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
         // a per-configuration Info.plist file. The cfbundle plist
         // is very similar to the application bundle plist
         this->CurrentLocalGenerator->GenerateAppleInfoPList(
-          gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+          gtgt, "$(EXECUTABLE_NAME)", plist);
         buildSettings->AddAttribute("INFOPLIST_FILE",
                                     this->CreateString(plist));
       } else {
@@ -2077,7 +2077,7 @@ void 
cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
         // so let it replace the framework name. This avoids creating
         // a per-configuration Info.plist file.
         this->CurrentLocalGenerator->GenerateFrameworkInfoPList(
-          gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+          gtgt, "$(EXECUTABLE_NAME)", plist);
         buildSettings->AddAttribute("INFOPLIST_FILE",
                                     this->CreateString(plist));
       } else {
@@ -2115,7 +2115,7 @@ void 
cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
         // so let it replace the executable name.  This avoids creating
         // a per-configuration Info.plist file.
         this->CurrentLocalGenerator->GenerateAppleInfoPList(
-          gtgt, "$(EXECUTABLE_NAME)", plist.c_str());
+          gtgt, "$(EXECUTABLE_NAME)", plist);
         buildSettings->AddAttribute("INFOPLIST_FILE",
                                     this->CreateString(plist));
       }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a2d0efe..fad1741 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2822,7 +2822,7 @@ static void cmLGInfoProp(cmMakefile* mf, 
cmGeneratorTarget* target,
 
 void cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
                                               const std::string& targetName,
-                                              const char* fname)
+                                              const std::string& fname)
 {
   // Find the Info.plist template.
   const char* in = target->GetProperty("MACOSX_BUNDLE_INFO_PLIST");
@@ -2856,11 +2856,12 @@ void 
cmLocalGenerator::GenerateAppleInfoPList(cmGeneratorTarget* target,
   cmLGInfoProp(mf, target, "MACOSX_BUNDLE_SHORT_VERSION_STRING");
   cmLGInfoProp(mf, target, "MACOSX_BUNDLE_BUNDLE_VERSION");
   cmLGInfoProp(mf, target, "MACOSX_BUNDLE_COPYRIGHT");
-  mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
+  mf->ConfigureFile(inFile, fname, false, false, false);
 }
 
 void cmLocalGenerator::GenerateFrameworkInfoPList(
-  cmGeneratorTarget* target, const std::string& targetName, const char* fname)
+  cmGeneratorTarget* target, const std::string& targetName,
+  const std::string& fname)
 {
   // Find the Info.plist template.
   const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST");
@@ -2890,5 +2891,5 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(
   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER");
   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING");
   cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION");
-  mf->ConfigureFile(inFile.c_str(), fname, false, false, false);
+  mf->ConfigureFile(inFile, fname, false, false, false);
 }
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f9839f6..de12190 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -340,14 +340,14 @@ public:
    */
   void GenerateAppleInfoPList(cmGeneratorTarget* target,
                               const std::string& targetName,
-                              const char* fname);
+                              const std::string& fname);
 
   /**
    * Generate a macOS framework Info.plist file.
    */
   void GenerateFrameworkInfoPList(cmGeneratorTarget* target,
                                   const std::string& targetName,
-                                  const char* fname);
+                                  const std::string& fname);
   /** Construct a comment for a custom command.  */
   std::string ConstructComment(cmCustomCommandGenerator const& ccg,
                                const char* default_comment = "");
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 560181f..0a0501b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3729,22 +3729,23 @@ void cmMakefile::ConfigureString(const std::string& 
input, std::string& output,
                                 lineNumber, true, true);
 }
 
-int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
-                              bool copyonly, bool atOnly, bool escapeQuotes,
+int cmMakefile::ConfigureFile(const std::string& infile,
+                              const std::string& outfile, bool copyonly,
+                              bool atOnly, bool escapeQuotes,
                               cmNewLineStyle newLine)
 {
   int res = 1;
   if (!this->CanIWriteThisFile(outfile)) {
-    cmSystemTools::Error("Attempt to write file: ", outfile,
+    cmSystemTools::Error("Attempt to write file: " + outfile +
                          " into a source directory.");
     return 0;
   }
   if (!cmSystemTools::FileExists(infile)) {
-    cmSystemTools::Error("File ", infile, " does not exist.");
+    cmSystemTools::Error("File " + infile + " does not exist.");
     return 0;
   }
   std::string soutfile = outfile;
-  std::string sinfile = infile;
+  const std::string& sinfile = infile;
   this->AddCMakeDependFile(sinfile);
   cmSystemTools::ConvertToUnixSlashes(soutfile);
 
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0800ce4..88b4c2f 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -610,8 +610,8 @@ public:
   /**
    * Copy file but change lines according to ConfigureString
    */
-  int ConfigureFile(const char* infile, const char* outfile, bool copyonly,
-                    bool atOnly, bool escapeQuotes,
+  int ConfigureFile(const std::string& infile, const std::string& outfile,
+                    bool copyonly, bool atOnly, bool escapeQuotes,
                     cmNewLineStyle = cmNewLineStyle());
 
   /**
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 6857d5a..47a8df4 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -54,8 +54,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& 
targetName,
   plist += this->GT->GetAppBundleDirectory(this->ConfigName,
                                            cmGeneratorTarget::ContentLevel);
   plist += "/Info.plist";
-  this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName,
-                                               plist.c_str());
+  this->LocalGenerator->GenerateAppleInfoPList(this->GT, targetName, plist);
   this->Makefile->AddCMakeOutputFile(plist);
   outpath = out;
 }
@@ -90,8 +89,7 @@ void cmOSXBundleGenerator::CreateFramework(const std::string& 
targetName,
   }
   plist += "/Info.plist";
   std::string name = cmSystemTools::GetFilenameName(targetName);
-  this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name,
-                                                   plist.c_str());
+  this->LocalGenerator->GenerateFrameworkInfoPList(this->GT, name, plist);
 
   // Generate Versions directory only for MacOSX frameworks
   if (this->Makefile->PlatformIsAppleEmbedded()) {
@@ -184,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const 
std::string& targetName,
                                    cmGeneratorTarget::ContentLevel);
   plist += "/Info.plist";
   std::string name = cmSystemTools::GetFilenameName(targetName);
-  this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist.c_str());
+  this->LocalGenerator->GenerateAppleInfoPList(this->GT, name, plist);
   this->Makefile->AddCMakeOutputFile(plist);
 }
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index 00a2d74..6ee82f4 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -622,8 +622,8 @@ void cmVisualStudio10TargetGenerator::Generate()
         propsLocal += this->DefaultArtifactDir;
         propsLocal += "\\nasm.props";
         ConvertToWindowsSlash(propsLocal);
-        this->Makefile->ConfigureFile(propsTemplate.c_str(),
-                                      propsLocal.c_str(), false, true, true);
+        this->Makefile->ConfigureFile(propsTemplate, propsLocal, false, true,
+                                      true);
         Elem(e1, "Import").Attribute("Project", propsLocal);
       }
     }

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

Summary of changes:
 Help/command/list.rst                              |  36 +++++-
 .../dev/list-prepend-and-pop-subcommands.rst       |   4 +
 Modules/Compiler/CrayPrgEnv.cmake                  | 111 +++++++++++++++--
 Modules/Platform/CrayLinuxEnvironment.cmake        |  72 +----------
 Source/CPack/WiX/cmCPackWIXGenerator.cxx           |   2 +-
 Source/CPack/cmCPackGenerator.cxx                  |   3 +-
 Source/CPack/cmCPackGenerator.h                    |   3 +-
 Source/CPack/cmCPackNSISGenerator.cxx              |   5 +-
 Source/CPack/cmCPackOSXX11Generator.cxx            |   6 +-
 Source/CPack/cmCPackPKGGenerator.cxx               |   6 +-
 Source/cmConfigureFileCommand.cxx                  |   6 +-
 Source/cmCreateTestSourceList.cxx                  |   3 +-
 Source/cmGlobalXCodeGenerator.cxx                  |   8 +-
 Source/cmListCommand.cxx                           | 138 ++++++++++++++++++++-
 Source/cmListCommand.h                             |   3 +
 Source/cmLocalGenerator.cxx                        |   9 +-
 Source/cmLocalGenerator.h                          |   4 +-
 Source/cmMakefile.cxx                              |  11 +-
 Source/cmMakefile.h                                |   4 +-
 Source/cmOSXBundleGenerator.cxx                    |   8 +-
 Source/cmVisualStudio10TargetGenerator.cxx         |   4 +-
 .../POP_BACK-NoArgs-result.txt}                    |   0
 Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt     |   1 +
 Tests/RunCMake/list/POP_BACK-NoArgs.cmake          |   1 +
 Tests/RunCMake/list/POP_BACK.cmake                 |  79 ++++++++++++
 .../POP_FRONT-NoArgs-result.txt}                   |   0
 Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt    |   1 +
 Tests/RunCMake/list/POP_FRONT-NoArgs.cmake         |   1 +
 Tests/RunCMake/list/POP_FRONT.cmake                |  79 ++++++++++++
 .../PREPEND-NoArgs-result.txt}                     |   0
 Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt      |   1 +
 Tests/RunCMake/list/PREPEND-NoArgs.cmake           |   1 +
 Tests/RunCMake/list/PREPEND.cmake                  |  33 +++++
 Tests/RunCMake/list/RunCMakeTest.cmake             |  12 ++
 34 files changed, 527 insertions(+), 128 deletions(-)
 create mode 100644 Help/release/dev/list-prepend-and-pop-subcommands.rst
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
list/POP_BACK-NoArgs-result.txt} (100%)
 create mode 100644 Tests/RunCMake/list/POP_BACK-NoArgs-stderr.txt
 create mode 100644 Tests/RunCMake/list/POP_BACK-NoArgs.cmake
 create mode 100644 Tests/RunCMake/list/POP_BACK.cmake
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
list/POP_FRONT-NoArgs-result.txt} (100%)
 create mode 100644 Tests/RunCMake/list/POP_FRONT-NoArgs-stderr.txt
 create mode 100644 Tests/RunCMake/list/POP_FRONT-NoArgs.cmake
 create mode 100644 Tests/RunCMake/list/POP_FRONT.cmake
 copy Tests/RunCMake/{while/MissingArgument-result.txt => 
list/PREPEND-NoArgs-result.txt} (100%)
 create mode 100644 Tests/RunCMake/list/PREPEND-NoArgs-stderr.txt
 create mode 100644 Tests/RunCMake/list/PREPEND-NoArgs.cmake
 create mode 100644 Tests/RunCMake/list/PREPEND.cmake


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to