[Cmake-commits] CMake branch, next, updated. v2.8.3-841-g324cd27

Ben Boeckel ben.boeckel at kitware.com
Mon Dec 13 14:29:09 EST 2010


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

The branch, next has been updated
       via  324cd27ad25bb9eab45c252d76e411390d4f0f14 (commit)
       via  91a2f7c5cfd65f1444c71dbbb620317eb6673a96 (commit)
       via  5cb930b3a9f4a6a7b79f78f84888ca22362d84ca (commit)
       via  77f224616b510e81070565393ac0ef24f2f0f24e (commit)
       via  347d1c9697bbc3dfc0b33ff96d83eda0c88a6aeb (commit)
      from  09c5aa789ce9aef2337c25ab4c56133b0bf9c802 (commit)

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

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=324cd27ad25bb9eab45c252d76e411390d4f0f14
commit 324cd27ad25bb9eab45c252d76e411390d4f0f14
Merge: 09c5aa7 91a2f7c
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Dec 13 14:26:56 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Dec 13 14:26:56 2010 -0500

    Merge branch 'dev/add-response-file-support' into next
    
    * dev/add-response-file-support:
      Add respose file support to ctest
      Add response file support in cmakemain.cxx
      Add code to parse response files from arguments
      Add tests for response file arguments
    
    Conflicts:
    	Source/cmakemain.cxx

diff --cc Source/cmakemain.cxx
index a51673c,355cb89..d388d22
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@@ -120,17 -120,8 +120,19 @@@ static const char * cmDocumentationOpti
    {"--trace", "Put cmake in trace mode.",
     "Print a trace of all calls made and from where with "
     "message(send_error ) calls."},
 +  {"--warn-uninitialized", "Warn about uninitialized values.",
 +   "Print a warning when an uninitialized variable is used."},
 +  {"--warn-unused-vars", "Warn about unused variables.",
 +   "Find variables that are declared or set, but not used."},
 +  {"--no-warn-unused-cli", "Don't warn about command line options.",
 +   "Don't find variables that are declared on the command line, but not "
 +   "used."},
 +  {"--check-system-vars", "Find problems with variable usage in system "
 +   "files.", "Normally, unused and uninitialized variables are searched for "
 +   "only in CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR. This flag tells CMake to "
 +   "warn about other files as well."},
+   {"@[file]", "Specify a response file.",
+    "Read arguments from a file. Each argument should be on its own line."},
    {"--help-command cmd [file]", "Print help for a single command and exit.",
     "Full documentation specific to the given command is displayed. "
     "If a file is specified, the documentation is written into and the output "

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91a2f7c5cfd65f1444c71dbbb620317eb6673a96
commit 91a2f7c5cfd65f1444c71dbbb620317eb6673a96
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Dec 13 13:08:11 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Dec 13 14:17:46 2010 -0500

    Add respose file support to ctest
    
    Since ctest calls cmake internally, it doesn't hit cmake's main to
    expand response files.

diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 3937d8d..5fbf546 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -232,6 +232,8 @@ static const char * cmDocumentationOptions[][3] =
   {"--print-labels", "Print all available test labels.",
    "This option will not run any tests, it will simply print the list of "
    "all labels associated with the test set."},
+  {"@[file]", "Specify a response file.",
+   "Read arguments from a file. Each argument should be on its own line."},
   {"--help-command <cmd> [<file>]", "Show help for a single command and exit.",
    "Prints the help for the command to stdout or to the specified file." },
   {"--help-command-list [<file>]", "List available commands and exit.",
@@ -251,16 +253,22 @@ static const char * cmDocumentationSeeAlso[][3] =
 };
 
 // this is a test driver program for cmCTest.
-int main (int argc, char *argv[])
+int main (int ac, char *av[])
 {
+  int argc;
+  char** argv;
+
   cmSystemTools::DoNotInheritStdPipes();
   cmSystemTools::EnableMSVCDebugHook();
+  cmSystemTools::ExpandResponseFiles(ac, av, argc, argv);
   cmSystemTools::FindExecutableDirectory(argv[0]);
 
   // Dispatch 'ctest --launch' mode directly.
   if(argc >= 2 && strcmp(argv[1], "--launch") == 0)
     {
-    return cmCTestLaunch::Main(argc, argv);
+    int ret = cmCTestLaunch::Main(argc, argv);
+    cmSystemTools::FreeArgv(argc, argv);
+    return ret;
     }
 
   int nocwd = 0;
@@ -307,7 +315,9 @@ int main (int argc, char *argv[])
 #ifdef cout
 #  undef cout
 #endif
-      return doc.PrintRequestedDocumentation(std::cout)? 0:1;
+      int ret = doc.PrintRequestedDocumentation(std::cout)? 0:1;
+      cmSystemTools::FreeArgv(argc, argv);
+      return ret;
 #define cout no_cout_use_cmCTestLog
       }
     }
@@ -327,6 +337,8 @@ int main (int argc, char *argv[])
   int res = inst.Run(args,&output);
   cmCTestLog(&inst, OUTPUT, output);
 
+  cmSystemTools::FreeArgv(argc, argv);
+
   return res;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5cb930b3a9f4a6a7b79f78f84888ca22362d84ca
commit 5cb930b3a9f4a6a7b79f78f84888ca22362d84ca
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Dec 13 13:07:39 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Dec 13 14:14:22 2010 -0500

    Add response file support in cmakemain.cxx
    
    This ensures that response file arguments are handled everywhere.

diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index ddff71d..355cb89 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -120,6 +120,8 @@ static const char * cmDocumentationOptions[][3] =
   {"--trace", "Put cmake in trace mode.",
    "Print a trace of all calls made and from where with "
    "message(send_error ) calls."},
+  {"@[file]", "Specify a response file.",
+   "Read arguments from a file. Each argument should be on its own line."},
   {"--help-command cmd [file]", "Print help for a single command and exit.",
    "Full documentation specific to the given command is displayed. "
    "If a file is specified, the documentation is written into and the output "
@@ -309,16 +311,25 @@ static void cmakemainProgressCallback(const char *m, float prog,
 
 int main(int ac, char** av)
 {
+  int argc;
+  char** argv;
+
   cmSystemTools::EnableMSVCDebugHook();
-  cmSystemTools::FindExecutableDirectory(av[0]);
-  if(ac > 1 && strcmp(av[1], "--build") == 0)
+  cmSystemTools::ExpandResponseFiles(ac, av, argc, argv);
+  cmSystemTools::FindExecutableDirectory(argv[0]);
+  if(argc > 1 && strcmp(argv[1], "--build") == 0)
     {
-    return do_build(ac, av);
+    int ret = do_build(argc, argv);
+    cmSystemTools::FreeArgv(argc, argv);
+    return ret;
     }
-  int ret = do_cmake(ac, av);
+  int ret = do_cmake(argc, argv);
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmDynamicLoader::FlushCache();
 #endif
+
+  cmSystemTools::FreeArgv(argc, argv);
+
   return ret;
 }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77f224616b510e81070565393ac0ef24f2f0f24e
commit 77f224616b510e81070565393ac0ef24f2f0f24e
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Dec 13 14:13:52 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Dec 13 14:13:52 2010 -0500

    Add code to parse response files from arguments

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7bc89a4..3bb3d2c 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -177,6 +177,65 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64)
 }
 #endif
 
+void cmSystemTools::ExpandResponseFiles(int ac, char** av,
+                                        int& argc, char**& argv)
+{
+  std::vector<std::string> args;
+
+  args.push_back(av[0]);
+  for(int i = 1; i < ac; ++i)
+    {
+      if(av[i][0] == '@')
+        {
+        std::string filename = av[i];
+
+        filename = cmSystemTools::CollapseFullPath(filename.c_str());
+        cmSystemTools::ConvertToUnixSlashes(filename);
+        if(cmSystemTools::FileExists(filename.c_str()))
+          {
+          std::ifstream fin(filename.c_str());
+          size_t offset = i;
+          while (fin)
+            {
+            std::string next_filearg;
+            std::getline(fin, next_filearg);
+            if (!next_filearg.empty())
+              {
+              args.push_back(next_filearg);
+              }
+            }
+          }
+        else
+          {
+          cmSystemTools::Error("Could not open command line response file ",
+                               filename.c_str());
+          }
+        }
+      else
+        {
+        args.push_back(av[i]);
+        }
+    }
+
+  argc = args.size();
+  argv = new char*[argc + 1];
+
+  for(size_t i = 0; i < argc; ++i)
+    {
+    argv[i] = strdup(args[i].c_str());
+    }
+  argv[argc] = NULL;
+}
+
+void cmSystemTools::FreeArgv(int argc, char** argv)
+{
+  for(int i = 0; i < argc; ++i)
+    {
+    free(argv[i]);
+    }
+  delete [] argv;
+}
+
 std::string cmSystemTools::EscapeQuotes(const char* str)
 {
   std::string result = "";
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 6f9147c..954eaeb 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -46,6 +46,13 @@ public:
   static void ExpandRegistryValues(std::string& source,
                                    KeyWOW64 view = KeyWOW64_Default);
 
+  ///! Expand response files in an argument list.
+  static void ExpandResponseFiles(int ac, char** av,
+                                  int& argc, char**& argv);
+
+  ///! Free an argument list returned by expanding response files.
+  static void FreeArgv(int ac, char** av);
+
   ///! Escape quotes in a string.
   static std::string EscapeQuotes(const char* str);
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=347d1c9697bbc3dfc0b33ff96d83eda0c88a6aeb
commit 347d1c9697bbc3dfc0b33ff96d83eda0c88a6aeb
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Fri Dec 10 15:45:39 2010 -0500
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Dec 13 14:05:33 2010 -0500

    Add tests for response file arguments

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 04f0774..c390eeb 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -713,6 +713,73 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
 
   ENDIF(NOT COMPILER_IS_COMO)
 
+  ADD_TEST(ResponseFileBasic ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ResponseFile"
+    "${CMake_BINARY_DIR}/Tests/ResponseFileBasic"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-noclean
+    --build-project ResponseFileBasic
+    --build-options "@${CMAKE_CURRENT_SOURCE_DIR}/ResponseFile/response-basic")
+  SET_TESTS_PROPERTIES(ResponseFileBasic PROPERTIES
+    PASS_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'foo'")
+  LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ResponseFileBasic")
+
+  ADD_TEST(ResponseFileWithSpaces ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ResponseFile"
+    "${CMake_BINARY_DIR}/Tests/ResponseFileWithSpaces"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-noclean
+    --build-project ResponseFileWithSpaces
+    --build-options "@${CMAKE_CURRENT_SOURCE_DIR}/ResponseFile/response-with-spaces")
+  SET_TESTS_PROPERTIES(ResponseFileWithSpaces PROPERTIES
+    PASS_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'with spaces'")
+  LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ResponseFileWithSpaces")
+
+  ADD_TEST(ResponseFileWithBlankLine ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ResponseFile"
+    "${CMake_BINARY_DIR}/Tests/ResponseFileWithBlankLine"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-noclean
+    --build-project ResponseFileWithBlankLine
+    --build-options "@${CMAKE_CURRENT_SOURCE_DIR}/ResponseFile/response-with-blank-line")
+  SET_TESTS_PROPERTIES(ResponseFileWithBlankLine PROPERTIES
+    PASS_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'after blank line'")
+  LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ResponseFileWithBlankLine")
+
+  ADD_TEST(ResponseFileDuplicate ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ResponseFile"
+    "${CMake_BINARY_DIR}/Tests/ResponseFileDuplicate"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-noclean
+    --build-project ResponseFileDuplicate
+    --build-options "@${CMAKE_CURRENT_SOURCE_DIR}/ResponseFile/response-duplicate")
+  SET_TESTS_PROPERTIES(ResponseFileDuplicate PROPERTIES
+    PASS_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'right'")
+  SET_TESTS_PROPERTIES(ResponseFileDuplicate PROPERTIES
+    FAIL_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'wrong'")
+  LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ResponseFileDuplicate")
+
+  ADD_TEST(ResponseFileWithMany ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ResponseFile"
+    "${CMake_BINARY_DIR}/Tests/ResponseFileWithMany"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-noclean
+    --build-project ResponseFileWithMany
+    --build-options "@${CMAKE_CURRENT_SOURCE_DIR}/ResponseFile/response-with-many")
+  SET_TESTS_PROPERTIES(ResponseFileWithMany PROPERTIES
+    PASS_REGULAR_EXPRESSION "RESPONSE_VARIABLE is: 'twentieth'")
+  LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ResponseFileWithMany")
+
   ADD_TEST(Example ${CMAKE_CTEST_COMMAND}
     --build-and-test
     "${CMake_SOURCE_DIR}/Example"
diff --git a/Tests/ResponseFile/CMakeLists.txt b/Tests/ResponseFile/CMakeLists.txt
new file mode 100644
index 0000000..1e7f287
--- /dev/null
+++ b/Tests/ResponseFile/CMakeLists.txt
@@ -0,0 +1 @@
+message(STATUS "RESPONSE_VARIABLE is: '${RESPONSE_VARIABLE}'")
diff --git a/Tests/ResponseFile/response-basic b/Tests/ResponseFile/response-basic
new file mode 100644
index 0000000..a413436
--- /dev/null
+++ b/Tests/ResponseFile/response-basic
@@ -0,0 +1 @@
+-DRESPONSE_VARIABLE=foo
diff --git a/Tests/ResponseFile/response-duplicate b/Tests/ResponseFile/response-duplicate
new file mode 100644
index 0000000..b56f40c
--- /dev/null
+++ b/Tests/ResponseFile/response-duplicate
@@ -0,0 +1,2 @@
+-DRESPONSE_VARIABLE=wrong
+-DRESPONSE_VARIABLE=right
diff --git a/Tests/ResponseFile/response-with-blank-line b/Tests/ResponseFile/response-with-blank-line
new file mode 100644
index 0000000..a22cdfc
--- /dev/null
+++ b/Tests/ResponseFile/response-with-blank-line
@@ -0,0 +1,3 @@
+-DRESPONSE_VARIABLE=before blank line
+
+-DRESPONSE_VARIABLE=after blank line
diff --git a/Tests/ResponseFile/response-with-many b/Tests/ResponseFile/response-with-many
new file mode 100644
index 0000000..41a0011
--- /dev/null
+++ b/Tests/ResponseFile/response-with-many
@@ -0,0 +1,20 @@
+-DRESPONSE_VARIABLE=first
+-DRESPONSE_VARIABLE=second
+-DRESPONSE_VARIABLE=third
+-DRESPONSE_VARIABLE=fourth
+-DRESPONSE_VARIABLE=fifth
+-DRESPONSE_VARIABLE=sixth
+-DRESPONSE_VARIABLE=seventh
+-DRESPONSE_VARIABLE=eighth
+-DRESPONSE_VARIABLE=ninth
+-DRESPONSE_VARIABLE=tenth
+-DRESPONSE_VARIABLE=eleventh
+-DRESPONSE_VARIABLE=twelfth
+-DRESPONSE_VARIABLE=thirteenth
+-DRESPONSE_VARIABLE=fourteenth
+-DRESPONSE_VARIABLE=fifteenth
+-DRESPONSE_VARIABLE=sixteenth
+-DRESPONSE_VARIABLE=seventeenth
+-DRESPONSE_VARIABLE=eighteenth
+-DRESPONSE_VARIABLE=nineteenth
+-DRESPONSE_VARIABLE=twentieth
diff --git a/Tests/ResponseFile/response-with-spaces b/Tests/ResponseFile/response-with-spaces
new file mode 100644
index 0000000..66eea61
--- /dev/null
+++ b/Tests/ResponseFile/response-with-spaces
@@ -0,0 +1 @@
+-DRESPONSE_VARIABLE=with spaces

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

Summary of changes:
 Source/cmSystemTools.cxx                    |   59 +++++++++++++++++++++++
 Source/cmSystemTools.h                      |    7 +++
 Source/cmakemain.cxx                        |   19 ++++++--
 Source/ctest.cxx                            |   18 ++++++-
 Tests/CMakeLists.txt                        |   67 +++++++++++++++++++++++++++
 Tests/ResponseFile/CMakeLists.txt           |    1 +
 Tests/ResponseFile/response-basic           |    1 +
 Tests/ResponseFile/response-duplicate       |    2 +
 Tests/ResponseFile/response-with-blank-line |    3 +
 Tests/ResponseFile/response-with-many       |   20 ++++++++
 Tests/ResponseFile/response-with-spaces     |    1 +
 11 files changed, 191 insertions(+), 7 deletions(-)
 create mode 100644 Tests/ResponseFile/CMakeLists.txt
 create mode 100644 Tests/ResponseFile/response-basic
 create mode 100644 Tests/ResponseFile/response-duplicate
 create mode 100644 Tests/ResponseFile/response-with-blank-line
 create mode 100644 Tests/ResponseFile/response-with-many
 create mode 100644 Tests/ResponseFile/response-with-spaces


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list