[Cmake-commits] CMake branch, master, updated. v3.8.1-1109-g8a19ce4

Kitware Robot kwrobot at kitware.com
Wed May 10 09:25:06 EDT 2017


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

The branch, master has been updated
       via  8a19ce47679580445a5ae291ecfbb3e88c8c6aeb (commit)
       via  53f1f55599808bf9771a32df35ac4d7a83f4007b (commit)
       via  5e0e03d953c03e1703708f4f579d903990edecb9 (commit)
       via  44c0b2b75a1c67a8bede285368f617f2c8e1dd77 (commit)
       via  da8faa8c7e54df0abbdfd50c29235320164453aa (commit)
       via  c3f41af2be49c1850c526eeac381b0c5989d7f15 (commit)
       via  c2c2bbb3d49837361ea02483e90e10a632975688 (commit)
       via  c36d63cd48fbfda57cd8cf25c029a3a175e10299 (commit)
       via  8986dec05dade19ee0f779c6c498dc0e04a8f8ee (commit)
      from  730cd10c64679bd0a8325bf7f0e9febda613bb8a (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=8a19ce47679580445a5ae291ecfbb3e88c8c6aeb
commit 8a19ce47679580445a5ae291ecfbb3e88c8c6aeb
Merge: 53f1f55 5e0e03d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 10 13:23:39 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed May 10 09:23:43 2017 -0400

    Merge topic 'ninja-windows-command-concat'
    
    5e0e03d9 Ninja: Fix command concatenation on Windows
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !801


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53f1f55599808bf9771a32df35ac4d7a83f4007b
commit 53f1f55599808bf9771a32df35ac4d7a83f4007b
Merge: 730cd10 44c0b2b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed May 10 13:22:32 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed May 10 09:22:46 2017 -0400

    Merge topic 'separate-command-registration'
    
    44c0b2b7 cmCommand: remove IsScriptable
    da8faa8c cmState: remove RemoveUnscriptableCommands
    c3f41af2 cmMakefile: don't check IsScriptable
    c2c2bbb3 cmake: register fake project commands in -P mode
    c36d63cd cmake: initialize with Role that controls which commands to register
    8986dec0 ctest: remove unused cmake instance
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !714


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e0e03d953c03e1703708f4f579d903990edecb9
commit 5e0e03d953c03e1703708f4f579d903990edecb9
Author:     Bernhard Burgermeister <bburgerm at googlemail.com>
AuthorDate: Thu May 4 17:57:20 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue May 9 11:34:42 2017 -0400

    Ninja: Fix command concatenation on Windows
    
    Put commands that contain `||` into brackets to avoid early abort of
    execution by `cmd.exe` because `||` has higher precedence than `&&` in
    `cmd.exe`.
    
    Add test to check for command execution after `||` as part of a
    parameter and as command separator.
    
    Fixes: #16850

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e0e3e54..124bd80 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -322,7 +322,13 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
     } else if (cmdLines.size() > 1) {
       cmd << "cmd.exe /C \"";
     }
-    cmd << *li;
+    // Put current cmdLine in brackets if it contains "||" because it has
+    // higher precedence than "&&" in cmd.exe
+    if (li->find("||") != std::string::npos) {
+      cmd << "( " << *li << " )";
+    } else {
+      cmd << *li;
+    }
   }
   if (cmdLines.size() > 1) {
     cmd << "\"";
diff --git a/Tests/RunCMake/Ninja/CommandConcat.cmake b/Tests/RunCMake/Ninja/CommandConcat.cmake
new file mode 100644
index 0000000..790cf9d
--- /dev/null
+++ b/Tests/RunCMake/Ninja/CommandConcat.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.7)
+project(concat_cmd NONE)
+set(output1 ${CMAKE_BINARY_DIR}/out1.txt)
+set(output2 ${CMAKE_BINARY_DIR}/out2.txt)
+file(REMOVE ${output1} ${output2})
+# Check that second command runs if first command contains "||" which has higher precedence than "&&" on Windows
+add_custom_target(concat_cmd ALL
+  COMMAND ${CMAKE_COMMAND} -E echo "Hello || pipe world" && ${CMAKE_COMMAND} -E touch ${output1} || exit 1
+  COMMAND ${CMAKE_COMMAND} -E touch ${output2})
+# Check output
+add_custom_target(check_output ALL
+  COMMAND ${CMAKE_COMMAND} -E copy ${output1} ${output1}.copy
+  COMMAND ${CMAKE_COMMAND} -E copy ${output2} ${output2}.copy)
+add_dependencies(check_output concat_cmd)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 8c3bc20..b3720fb 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -40,6 +40,16 @@ run_CMP0058(NEW-by)
 
 run_cmake(CustomCommandDepfile)
 
+function(run_CommandConcat)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CommandConcat-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+  run_cmake(CommandConcat)
+  run_cmake_command(CommandConcat-build ${CMAKE_COMMAND} --build .)
+endfunction()
+run_CommandConcat()
+
 function(run_SubDir)
   # Use a single build tree for a few tests without cleaning.
   set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SubDir-build)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44c0b2b75a1c67a8bede285368f617f2c8e1dd77
commit 44c0b2b75a1c67a8bede285368f617f2c8e1dd77
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Mon Apr 17 23:00:07 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:58:01 2017 +0200

    cmCommand: remove IsScriptable

diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h
index 8ce5ca2..0038883 100644
--- a/Source/cmBreakCommand.h
+++ b/Source/cmBreakCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "break"; }
diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h
index 00f645a..9008c27 100644
--- a/Source/cmBuildNameCommand.h
+++ b/Source/cmBuildNameCommand.h
@@ -19,7 +19,6 @@ public:
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) CM_OVERRIDE;
   std::string GetName() const CM_OVERRIDE { return "build_name"; }
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h
index fe148a3..4263e75 100644
--- a/Source/cmCMakeHostSystemInformationCommand.h
+++ b/Source/cmCMakeHostSystemInformationCommand.h
@@ -41,11 +41,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-  * This determines if the command is invoked when in script mode.
-  */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
   * The name of the command as specified in CMakeList.txt.
   */
   std::string GetName() const CM_OVERRIDE
diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h
index 8db0860..d264675 100644
--- a/Source/cmCMakeMinimumRequired.h
+++ b/Source/cmCMakeMinimumRequired.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "cmake_minimum_required"; }
diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h
index 789e294..cc02169 100644
--- a/Source/cmCMakePolicyCommand.h
+++ b/Source/cmCMakePolicyCommand.h
@@ -34,11 +34,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-    * This determines if the command is invoked when in script mode.
-    */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
     * The name of the command as specified in CMakeList.txt.
     */
   std::string GetName() const CM_OVERRIDE { return "cmake_policy"; }
diff --git a/Source/cmCommand.h b/Source/cmCommand.h
index 62eced0..2e2ba43 100644
--- a/Source/cmCommand.h
+++ b/Source/cmCommand.h
@@ -80,11 +80,6 @@ public:
   virtual cmCommand* Clone() = 0;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  virtual bool IsScriptable() const { return false; }
-
-  /**
    * This determines if the command is defined in a cmake script.
    * It is the case for cmMacroHelperCommand and cmFunctionHelperCommand.
    */
diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h
index 882219d..402423d 100644
--- a/Source/cmConfigureFileCommand.h
+++ b/Source/cmConfigureFileCommand.h
@@ -30,11 +30,6 @@ public:
    */
   std::string GetName() const CM_OVERRIDE { return "configure_file"; }
 
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
 private:
   int ConfigureFile();
 
diff --git a/Source/cmContinueCommand.h b/Source/cmContinueCommand.h
index 4428d79..4b416a4 100644
--- a/Source/cmContinueCommand.h
+++ b/Source/cmContinueCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "continue"; }
diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h
index 7c141dd..38d1d93 100644
--- a/Source/cmDisallowedCommand.h
+++ b/Source/cmDisallowedCommand.h
@@ -42,11 +42,6 @@ public:
     return this->Command->HasFinalPass();
   }
 
-  bool IsScriptable() const CM_OVERRIDE
-  {
-    return this->Command->IsScriptable();
-  }
-
   std::string GetName() const CM_OVERRIDE { return this->Command->GetName(); }
 
 private:
diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h
index 53d35cf..2a59612 100644
--- a/Source/cmExecProgramCommand.h
+++ b/Source/cmExecProgramCommand.h
@@ -41,11 +41,6 @@ public:
    */
   std::string GetName() const CM_OVERRIDE { return "exec_program"; }
 
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
 private:
   static bool RunCommand(const char* command, std::string& output, int& retVal,
                          const char* directory = CM_NULLPTR,
diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h
index 65e16d4..e57e22d 100644
--- a/Source/cmExecuteProcessCommand.h
+++ b/Source/cmExecuteProcessCommand.h
@@ -37,11 +37,6 @@ public:
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "execute_process"; }
-
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 121fec0..ff0b35e 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -32,11 +32,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "file"; }
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 4a60505..41af976 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -37,11 +37,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "find_library"; }
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index c42ecce..e4ecfad 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -61,11 +61,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "find_package"; }
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 205bb17..92849c3 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -37,11 +37,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "find_path"; }
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 73894ba..af56aef 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -38,11 +38,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "find_program"; }
diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h
index c71b905..30f0342 100644
--- a/Source/cmForEachCommand.h
+++ b/Source/cmForEachCommand.h
@@ -49,11 +49,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "foreach"; }
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 31adcb7..4285d26 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -40,11 +40,6 @@ public:
   }
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h
index d6cc18e..fa13aa4 100644
--- a/Source/cmFunctionCommand.h
+++ b/Source/cmFunctionCommand.h
@@ -46,11 +46,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "function"; }
diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h
index c454e34..b0ddb22 100644
--- a/Source/cmGetCMakePropertyCommand.h
+++ b/Source/cmGetCMakePropertyCommand.h
@@ -25,11 +25,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "get_cmake_property"; }
diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h
index 0adf818..f91a466 100644
--- a/Source/cmGetDirectoryPropertyCommand.h
+++ b/Source/cmGetDirectoryPropertyCommand.h
@@ -25,11 +25,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "get_directory_property"; }
diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h
index efc9d7b..cf64564 100644
--- a/Source/cmGetFilenameComponentCommand.h
+++ b/Source/cmGetFilenameComponentCommand.h
@@ -34,11 +34,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "get_filename_component"; }
diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h
index a57c675..7bbcec0 100644
--- a/Source/cmGetPropertyCommand.h
+++ b/Source/cmGetPropertyCommand.h
@@ -27,11 +27,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "get_property"; }
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 59d32e6..c6c44cb 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -69,11 +69,6 @@ public:
    */
   std::string GetName() const CM_OVERRIDE { return "if"; }
 
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
   // Filter the given variable definition based on policy CMP0054.
   static const char* GetDefinitionIfUnquoted(
     const cmMakefile* mf, cmExpandedCommandArgument const& argument);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index 06200cd..5a37800 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -34,11 +34,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "include"; }
diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h
index 8d4aeb1..7272ea1 100644
--- a/Source/cmListCommand.h
+++ b/Source/cmListCommand.h
@@ -32,11 +32,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "list"; }
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index 583f801..22977f9 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -41,11 +41,6 @@ public:
   }
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h
index f0020ff..fd9c92b 100644
--- a/Source/cmMacroCommand.h
+++ b/Source/cmMacroCommand.h
@@ -46,11 +46,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "macro"; }
diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h
index 54f4ab3..e2f0932 100644
--- a/Source/cmMakeDirectoryCommand.h
+++ b/Source/cmMakeDirectoryCommand.h
@@ -40,11 +40,6 @@ public:
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "make_directory"; }
-
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h
index 8c2f85b..4f80746 100644
--- a/Source/cmMarkAsAdvancedCommand.h
+++ b/Source/cmMarkAsAdvancedCommand.h
@@ -36,14 +36,6 @@ public:
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "mark_as_advanced"; }
-
-  /**
-   * This determines if the command is invoked when in script mode.
-   * mark_as_advanced() will have no effect in script mode, but this will
-   * make many of the modules usable in cmake/ctest scripts, (among them
-   * FindUnixMake.cmake used by the CTEST_BUILD command.
-  */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h
index 496d836..ef0eb4a 100644
--- a/Source/cmMathCommand.h
+++ b/Source/cmMathCommand.h
@@ -29,11 +29,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "math"; }
diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h
index ca83ed6..fd2dbe7 100644
--- a/Source/cmMessageCommand.h
+++ b/Source/cmMessageCommand.h
@@ -35,11 +35,6 @@ public:
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "message"; }
-
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h
index 86fa41f..0227357 100644
--- a/Source/cmOptionCommand.h
+++ b/Source/cmOptionCommand.h
@@ -36,11 +36,6 @@ public:
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "option"; }
-
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 };
 
 #endif
diff --git a/Source/cmParseArgumentsCommand.h b/Source/cmParseArgumentsCommand.h
index 4d9416d..f3de5b6 100644
--- a/Source/cmParseArgumentsCommand.h
+++ b/Source/cmParseArgumentsCommand.h
@@ -31,11 +31,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "cmake_parse_arguments"; }
diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h
index 38223a5..84e591d 100644
--- a/Source/cmRemoveCommand.h
+++ b/Source/cmRemoveCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "remove"; }
diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h
index ceed6b5..a4a6283 100644
--- a/Source/cmReturnCommand.h
+++ b/Source/cmReturnCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "return"; }
diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h
index 7edde48..e4df5da 100644
--- a/Source/cmSeparateArgumentsCommand.h
+++ b/Source/cmSeparateArgumentsCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "separate_arguments"; }
diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h
index 1c67bf9..e3a3175 100644
--- a/Source/cmSetCommand.h
+++ b/Source/cmSetCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "set"; }
diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h
index e04de6e..4657b66 100644
--- a/Source/cmSetDirectoryPropertiesCommand.h
+++ b/Source/cmSetDirectoryPropertiesCommand.h
@@ -29,11 +29,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index 3657f63..7f5c977 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -36,11 +36,6 @@ public:
    */
   std::string GetName() const CM_OVERRIDE { return "set_property"; }
 
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
 private:
   std::set<std::string> Names;
   std::string PropertyName;
diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h
index c7425f6..e133c6c 100644
--- a/Source/cmSiteNameCommand.h
+++ b/Source/cmSiteNameCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "site_name"; }
diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h
index 89ecb12..dc3ce5a 100644
--- a/Source/cmStringCommand.h
+++ b/Source/cmStringCommand.h
@@ -32,11 +32,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "string"; }
diff --git a/Source/cmUnexpectedCommand.h b/Source/cmUnexpectedCommand.h
index aee5d4d..1605997 100644
--- a/Source/cmUnexpectedCommand.h
+++ b/Source/cmUnexpectedCommand.h
@@ -29,8 +29,6 @@ public:
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) CM_OVERRIDE;
 
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
   std::string GetName() const CM_OVERRIDE { return this->Name; }
 
 private:
diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h
index 7e0f5b5..d60bd3e 100644
--- a/Source/cmUnsetCommand.h
+++ b/Source/cmUnsetCommand.h
@@ -33,11 +33,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "unset"; }
diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h
index e8bd8c6..104614a 100644
--- a/Source/cmUseMangledMesaCommand.h
+++ b/Source/cmUseMangledMesaCommand.h
@@ -19,7 +19,6 @@ public:
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) CM_OVERRIDE;
   std::string GetName() const CM_OVERRIDE { return "use_mangled_mesa"; }
-  bool IsScriptable() const CM_OVERRIDE { return true; }
 protected:
   void CopyAndFullPathMesaHeader(const char* source, const char* outdir);
 };
diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h
index 7096ed5..ca338e6 100644
--- a/Source/cmVariableWatchCommand.h
+++ b/Source/cmVariableWatchCommand.h
@@ -38,11 +38,6 @@ public:
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) CM_OVERRIDE;
 
-  /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
   /** This command does not really have a final pass but it needs to
       stay alive since it owns variable watch callback information. */
   bool HasFinalPass() const CM_OVERRIDE { return true; }
diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h
index daf1046..d353063 100644
--- a/Source/cmWhileCommand.h
+++ b/Source/cmWhileCommand.h
@@ -59,11 +59,6 @@ public:
   }
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "while"; }
diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h
index 7196ccf..aea8653 100644
--- a/Source/cmWriteFileCommand.h
+++ b/Source/cmWriteFileCommand.h
@@ -32,11 +32,6 @@ public:
                    cmExecutionStatus& status) CM_OVERRIDE;
 
   /**
-   * This determines if the command is invoked when in script mode.
-   */
-  bool IsScriptable() const CM_OVERRIDE { return true; }
-
-  /**
    * The name of the command as specified in CMakeList.txt.
    */
   std::string GetName() const CM_OVERRIDE { return "write_file"; }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da8faa8c7e54df0abbdfd50c29235320164453aa
commit da8faa8c7e54df0abbdfd50c29235320164453aa
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Thu Apr 20 21:26:11 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:58:01 2017 +0200

    cmState: remove RemoveUnscriptableCommands

diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index bf25e65..a44bc3d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -23,7 +23,6 @@
 #include "cmDocumentationEntry.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
-#include "cmState.h"
 #include "cmStateSnapshot.h"
 #include "cmSystemTools.h"
 #include "cm_auto_ptr.hxx"
@@ -193,7 +192,6 @@ int main(int argc, char const* const* argv)
   cminst.SetHomeDirectory("");
   cminst.SetHomeOutputDirectory("");
   cminst.GetCurrentSnapshot().SetDefaultDefinitions();
-  cminst.GetState()->RemoveUnscriptableCommands();
   cmGlobalGenerator cmgg(&cminst);
   CM_AUTO_PTR<cmMakefile> globalMF(
     new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 444d0e3..1fea8e5 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -290,10 +290,6 @@ void cmCTestScriptHandler::CreateCMake()
 
   this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
 
-  // remove all cmake commands which are not scriptable, since they can't be
-  // used in ctest scripts
-  this->CMake->GetState()->RemoveUnscriptableCommands();
-
   // add any ctest specific commands, probably should have common superclass
   // for ctest commands to clean this up. If a couple more commands are
   // created with the same format lets do that - ken
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index aca0358..43f439c 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -410,21 +410,6 @@ void cmState::AddCommand(cmCommand* command)
   this->Commands.insert(std::make_pair(name, command));
 }
 
-void cmState::RemoveUnscriptableCommands()
-{
-  std::vector<std::string> unscriptableCommands;
-  for (std::map<std::string, cmCommand*>::iterator pos =
-         this->Commands.begin();
-       pos != this->Commands.end();) {
-    if (!pos->second->IsScriptable()) {
-      delete pos->second;
-      this->Commands.erase(pos++);
-    } else {
-      ++pos;
-    }
-  }
-}
-
 cmCommand* cmState::GetCommand(std::string const& name) const
 {
   cmCommand* command = CM_NULLPTR;
diff --git a/Source/cmState.h b/Source/cmState.h
index d2af5ce..240d75b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -121,7 +121,6 @@ public:
 
   cmCommand* GetCommand(std::string const& name) const;
   void AddCommand(cmCommand* command);
-  void RemoveUnscriptableCommands();
   void RenameCommand(std::string const& oldName, std::string const& newName);
   void RemoveUserDefinedCommands();
   std::vector<std::string> GetCommandNames() const;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3f41af2be49c1850c526eeac381b0c5989d7f15
commit c3f41af2be49c1850c526eeac381b0c5989d7f15
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Mon Apr 17 22:59:14 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:58:01 2017 +0200

    cmMakefile: don't check IsScriptable

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ab0707e..ad35177 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -272,11 +272,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
     pcmd->SetMakefile(this);
 
     // Decide whether to invoke the command.
-    if (!cmSystemTools::GetFatalErrorOccured() &&
-        (this->GetCMakeInstance()->GetWorkingMode() != cmake::SCRIPT_MODE ||
-         pcmd->IsScriptable()))
-
-    {
+    if (!cmSystemTools::GetFatalErrorOccured()) {
       // if trace is enabled, print out invoke information
       if (this->GetCMakeInstance()->GetTrace()) {
         this->PrintCommandTrace(lff);
@@ -298,15 +294,6 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
         // use the command
         this->FinalPassCommands.push_back(pcmd.release());
       }
-    } else if (this->GetCMakeInstance()->GetWorkingMode() ==
-                 cmake::SCRIPT_MODE &&
-               !pcmd->IsScriptable()) {
-      std::string error = "Command ";
-      error += pcmd->GetName();
-      error += "() is not scriptable";
-      this->IssueMessage(cmake::FATAL_ERROR, error);
-      result = false;
-      cmSystemTools::SetFatalErrorOccured();
     }
   } else {
     if (!cmSystemTools::GetFatalErrorOccured()) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2c2bbb3d49837361ea02483e90e10a632975688
commit c2c2bbb3d49837361ea02483e90e10a632975688
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Mon May 8 22:29:08 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:58:01 2017 +0200

    cmake: register fake project commands in -P mode

diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 1576722..adf46ff 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -266,3 +266,64 @@ void GetProjectCommands(cmState* state)
     "The variable_requires command should not be called; see CMP0035."));
 #endif
 }
+
+void GetProjectCommandsInScriptMode(cmState* state)
+{
+#define CM_UNEXPECTED_PROJECT_COMMAND(NAME)                                   \
+  state->AddCommand(new cmUnexpectedCommand(NAME, "command is not "           \
+                                                  "scriptable"))
+
+  CM_UNEXPECTED_PROJECT_COMMAND("add_compile_options");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_custom_command");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_custom_target");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_definitions");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_dependencies");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_executable");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_library");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_subdirectory");
+  CM_UNEXPECTED_PROJECT_COMMAND("add_test");
+  CM_UNEXPECTED_PROJECT_COMMAND("aux_source_directory");
+  CM_UNEXPECTED_PROJECT_COMMAND("build_command");
+  CM_UNEXPECTED_PROJECT_COMMAND("create_test_sourcelist");
+  CM_UNEXPECTED_PROJECT_COMMAND("define_property");
+  CM_UNEXPECTED_PROJECT_COMMAND("enable_language");
+  CM_UNEXPECTED_PROJECT_COMMAND("enable_testing");
+  CM_UNEXPECTED_PROJECT_COMMAND("export");
+  CM_UNEXPECTED_PROJECT_COMMAND("fltk_wrap_ui");
+  CM_UNEXPECTED_PROJECT_COMMAND("get_source_file_property");
+  CM_UNEXPECTED_PROJECT_COMMAND("get_target_property");
+  CM_UNEXPECTED_PROJECT_COMMAND("get_test_property");
+  CM_UNEXPECTED_PROJECT_COMMAND("include_directories");
+  CM_UNEXPECTED_PROJECT_COMMAND("include_external_msproject");
+  CM_UNEXPECTED_PROJECT_COMMAND("include_regular_expression");
+  CM_UNEXPECTED_PROJECT_COMMAND("install");
+  CM_UNEXPECTED_PROJECT_COMMAND("link_directories");
+  CM_UNEXPECTED_PROJECT_COMMAND("link_libraries");
+  CM_UNEXPECTED_PROJECT_COMMAND("load_cache");
+  CM_UNEXPECTED_PROJECT_COMMAND("project");
+  CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_cpp");
+  CM_UNEXPECTED_PROJECT_COMMAND("qt_wrap_ui");
+  CM_UNEXPECTED_PROJECT_COMMAND("remove_definitions");
+  CM_UNEXPECTED_PROJECT_COMMAND("set_source_files_properties");
+  CM_UNEXPECTED_PROJECT_COMMAND("set_target_properties");
+  CM_UNEXPECTED_PROJECT_COMMAND("set_tests_properties");
+  CM_UNEXPECTED_PROJECT_COMMAND("source_group");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_compile_definitions");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_compile_features");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_compile_options");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_include_directories");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_link_libraries");
+  CM_UNEXPECTED_PROJECT_COMMAND("target_sources");
+  CM_UNEXPECTED_PROJECT_COMMAND("try_compile");
+  CM_UNEXPECTED_PROJECT_COMMAND("try_run");
+
+  // deprected commands
+  CM_UNEXPECTED_PROJECT_COMMAND("export_library_dependencies");
+  CM_UNEXPECTED_PROJECT_COMMAND("load_command");
+  CM_UNEXPECTED_PROJECT_COMMAND("output_required_files");
+  CM_UNEXPECTED_PROJECT_COMMAND("subdir_depends");
+  CM_UNEXPECTED_PROJECT_COMMAND("utility_source");
+  CM_UNEXPECTED_PROJECT_COMMAND("variable_requires");
+
+#undef CM_UNEXPECTED_PROJECT_COMMAND
+}
diff --git a/Source/cmCommands.h b/Source/cmCommands.h
index 7895ece..1f8fafb 100644
--- a/Source/cmCommands.h
+++ b/Source/cmCommands.h
@@ -12,5 +12,6 @@ class cmState;
  */
 void GetScriptingCommands(cmState* state);
 void GetProjectCommands(cmState* state);
+void GetProjectCommandsInScriptMode(cmState* state);
 
 #endif
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 87b3597..53e9ab0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -447,6 +447,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         cmSystemTools::Error("No cmake script provided.");
         return false;
       }
+      // Register fake project commands that hint misuse in script mode.
+      GetProjectCommandsInScriptMode(this->State);
       this->ReadListFile(args, path.c_str());
     } else if (arg.find("--find-package", 0) == 0) {
       findPackageMode = true;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c36d63cd48fbfda57cd8cf25c029a3a175e10299
commit c36d63cd48fbfda57cd8cf25c029a3a175e10299
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Sat Apr 29 21:28:14 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:29:44 2017 +0200

    cmake: initialize with Role that controls which commands to register

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c5495c6..c873529 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -620,7 +620,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
                           << installComponent << std::endl);
         }
 
-        cmake cm;
+        cmake cm(cmake::RoleScript);
         cm.SetHomeDirectory("");
         cm.SetHomeOutputDirectory("");
         cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index a48c8cd..bf25e65 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -189,7 +189,7 @@ int main(int argc, char const* const* argv)
   cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
               "Read CPack config file: " << cpackConfigFile << std::endl);
 
-  cmake cminst;
+  cmake cminst(cmake::RoleScript);
   cminst.SetHomeDirectory("");
   cminst.SetHomeOutputDirectory("");
   cminst.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index ed7dd5d..cc29071 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -167,7 +167,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
     return 1;
   }
 
-  cmake cm;
+  cmake cm(cmake::RoleProject);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   std::string cmakeOutString;
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index a782150..5b21351 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -623,7 +623,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
 
 void cmCTestLaunch::LoadConfig()
 {
-  cmake cm;
+  cmake cm(cmake::RoleScript);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 60e48b6..444d0e3 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -275,7 +275,7 @@ void cmCTestScriptHandler::CreateCMake()
     delete this->GlobalGenerator;
     delete this->Makefile;
   }
-  this->CMake = new cmake;
+  this->CMake = new cmake(cmake::RoleScript);
   this->CMake->SetHomeDirectory("");
   this->CMake->SetHomeOutputDirectory("");
   this->CMake->GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index a5cc1fa..349e91a 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1650,7 +1650,7 @@ void cmCTestTestHandler::GetListOfTests()
   }
   cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
                      "Constructing a list of tests" << std::endl, this->Quiet);
-  cmake cm;
+  cmake cm(cmake::RoleScript);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 1698a84..28a0e95 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -81,7 +81,7 @@ int main(int argc, char const* const* argv)
   cmDocumentation doc;
   doc.addCMakeStandardDocSections();
   if (doc.CheckOptions(argc, argv)) {
-    cmake hcm;
+    cmake hcm(cmake::RoleInternal);
     hcm.SetHomeDirectory("");
     hcm.SetHomeOutputDirectory("");
     hcm.AddCMakePaths();
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index ca824c0..0fa7aa5 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -40,7 +40,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
     "Welcome to ccmake, curses based user interface for CMake.");
   this->HelpMessage.push_back("");
   this->HelpMessage.push_back(s_ConstHelpMessage);
-  this->CMakeInstance = new cmake;
+  this->CMakeInstance = new cmake(cmake::RoleProject);
   this->CMakeInstance->SetCMakeEditCommand(
     cmSystemTools::GetCMakeCursesCommand());
 
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index b955d77..7fa2ac6 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
   doc.addCMakeStandardDocSections();
   if (argc2 > 1 && doc.CheckOptions(argc2, argv2)) {
     // Construct and print requested documentation.
-    cmake hcm;
+    cmake hcm(cmake::RoleInternal);
     hcm.SetHomeDirectory("");
     hcm.SetHomeOutputDirectory("");
     hcm.AddCMakePaths();
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 28820a6..d473d9b 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -27,7 +27,7 @@ QCMake::QCMake(QObject* p)
   cmSystemTools::SetStdoutCallback(QCMake::stdoutCallback, this);
   cmSystemTools::SetStderrCallback(QCMake::stderrCallback, this);
 
-  this->CMakeInstance = new cmake;
+  this->CMakeInstance = new cmake(cmake::RoleProject);
   this->CMakeInstance->SetCMakeEditCommand(
     cmSystemTools::GetCMakeGUICommand());
   this->CMakeInstance->SetProgressCallback(QCMake::progressCallback, this);
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 010221e..f469998 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -416,7 +416,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
     }
   }
 
-  cmake cm;
+  cmake cm(cmake::RoleScript);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 587e18a..d9a8cab 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1903,7 +1903,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg,
     }
   }
 
-  cmake cm;
+  cmake cm(cmake::RoleInternal);
   cm.SetHomeDirectory(dir_top_src);
   cm.SetHomeOutputDirectory(dir_top_bld);
   CM_AUTO_PTR<cmGlobalNinjaGenerator> ggd(
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 1fcd3cb..7e953ce 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -61,7 +61,7 @@ cmGraphVizWriter::cmGraphVizWriter(
 void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
                                     const char* fallbackSettingsFileName)
 {
-  cmake cm;
+  cmake cm(cmake::RoleScript);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cb11060..ab0707e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3187,7 +3187,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
   // make sure the same generator is used
   // use this program as the cmake to be run, it should not
   // be run that way but the cmake object requires a vailid path
-  cmake cm;
+  cmake cm(cmake::RoleProject);
   cm.SetIsInTryCompile(true);
   cmGlobalGenerator* gg =
     cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index eec1fc6..7461a0a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -286,7 +286,7 @@ cmQtAutoGenerators::cmQtAutoGenerators()
 bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
                              const std::string& config)
 {
-  cmake cm;
+  cmake cm(cmake::RoleScript);
   cm.SetHomeOutputDirectory(targetDirectory);
   cm.SetHomeDirectory(targetDirectory);
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 4e9e80f..defba77 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -215,7 +215,7 @@ bool cmServerProtocol::Activate(cmServer* server,
 {
   assert(server);
   this->m_Server = server;
-  this->m_CMakeInstance = std::make_unique<cmake>();
+  this->m_CMakeInstance = std::make_unique<cmake>(cmake::RoleProject);
   const bool result = this->DoActivate(request, errorMessage);
   if (!result) {
     this->m_CMakeInstance = CM_NULLPTR;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 737587d..87b3597 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -136,7 +136,7 @@ void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
   cm->MarkCliAsUsed(variable);
 }
 
-cmake::cmake()
+cmake::cmake(Role role)
 {
   this->Trace = false;
   this->TraceExpand = false;
@@ -174,8 +174,12 @@ cmake::cmake()
 
   this->AddDefaultGenerators();
   this->AddDefaultExtraGenerators();
-  this->AddScriptingCommands();
-  this->AddProjectCommands();
+  if (role == RoleScript || role == RoleProject) {
+    this->AddScriptingCommands();
+  }
+  if (role == RoleProject) {
+    this->AddProjectCommands();
+  }
 
   // Make sure we can capture the build tool output.
   cmSystemTools::EnableVSConsoleOutput();
@@ -1888,7 +1892,7 @@ int cmake::CheckBuildSystem()
 
   // Read the rerun check file and use it to decide whether to do the
   // global generate.
-  cmake cm;
+  cmake cm(RoleScript); // Actually, all we need is the `set` command.
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cm.GetCurrentSnapshot().SetDefaultDefinitions();
@@ -2419,6 +2423,9 @@ int cmake::Build(const std::string& dir, const std::string& target,
     std::string homeOutputOrig = this->GetHomeOutputDirectory();
     this->SetDirectoriesFromFile(cachePath.c_str());
 
+    this->AddScriptingCommands();
+    this->AddProjectCommands();
+
     int ret = this->Configure();
     if (ret) {
       cmSystemTools::Message("CMake Configure step failed.  "
diff --git a/Source/cmake.h b/Source/cmake.h
index 16a2830..4ddacf7 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -58,6 +58,13 @@ class cmake
   CM_DISABLE_COPY(cmake)
 
 public:
+  enum Role
+  {
+    RoleInternal, // no commands
+    RoleScript,   // script commands
+    RoleProject   // all commands
+  };
+
   enum MessageType
   {
     AUTHOR_WARNING,
@@ -112,7 +119,7 @@ public:
   typedef std::map<std::string, cmInstalledFile> InstalledFilesMap;
 
   /// Default constructor
-  cmake();
+  cmake(Role role);
   /// Destructor
   ~cmake();
 
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 3d11241..f472b8a 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -201,7 +201,7 @@ int do_cmake(int ac, char const* const* av)
   doc.addCMakeStandardDocSections();
   if (doc.CheckOptions(ac, av)) {
     // Construct and print requested documentation.
-    cmake hcm;
+    cmake hcm(cmake::RoleInternal);
     hcm.SetHomeDirectory("");
     hcm.SetHomeOutputDirectory("");
     hcm.AddCMakePaths();
@@ -283,13 +283,13 @@ int do_cmake(int ac, char const* const* av)
     }
   }
   if (sysinfo) {
-    cmake cm;
+    cmake cm(cmake::RoleProject);
     cm.SetHomeDirectory("");
     cm.SetHomeOutputDirectory("");
     int ret = cm.GetSystemInformation(args);
     return ret;
   }
-  cmake cm;
+  cmake cm(cmake::RoleProject);
   cm.SetHomeDirectory("");
   cm.SetHomeOutputDirectory("");
   cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
@@ -407,7 +407,7 @@ static int do_build(int ac, char const* const* av)
     return 1;
   }
 
-  cmake cm;
+  cmake cm(cmake::RoleInternal);
   cmSystemTools::SetMessageCallback(cmakemainMessageCallback, (void*)&cm);
   cm.SetProgressCallback(cmakemainProgressCallback, (void*)&cm);
   return cm.Build(dir, target, config, nativeOptions, clean);
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index cc954e6..dc267e7 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -583,7 +583,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         std::cerr << "-E capabilities accepts no additional arguments\n";
         return 1;
       }
-      cmake cm;
+      cmake cm(cmake::RoleInternal);
 #if defined(HAVE_SERVER_MODE) && HAVE_SERVER_MODE
       std::cout << cm.ReportCapabilities(true);
 #else
@@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
       const bool verbose = isCMakeVerbose();
 
       // Create a cmake object instance to process dependencies.
-      cmake cm;
+      cmake cm(cmake::RoleScript); // All we need is the `set` command.
       std::string gen;
       std::string homeDir;
       std::string startDir;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8986dec05dade19ee0f779c6c498dc0e04a8f8ee
commit 8986dec05dade19ee0f779c6c498dc0e04a8f8ee
Author:     Daniel Pfeifer <daniel at pfeifer-mail.de>
AuthorDate: Thu Apr 20 21:29:36 2017 +0200
Commit:     Daniel Pfeifer <daniel at pfeifer-mail.de>
CommitDate: Mon May 8 22:29:44 2017 +0200

    ctest: remove unused cmake instance

diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 15d4cf4..84e815d 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -7,7 +7,6 @@
 #include "cmCTest.h"
 #include "cmDocumentation.h"
 #include "cmSystemTools.h"
-#include "cmake.h"
 
 #include "cmsys/Encoding.hxx"
 #if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
@@ -170,11 +169,6 @@ int main(int argc, char const* const* argv)
     cmDocumentation doc;
     doc.addCTestStandardDocSections();
     if (doc.CheckOptions(argc, argv)) {
-      cmake hcm;
-      hcm.SetHomeDirectory("");
-      hcm.SetHomeOutputDirectory("");
-      hcm.AddCMakePaths();
-
       // Construct and print requested documentation.
       cmCTestScriptHandler* ch =
         static_cast<cmCTestScriptHandler*>(inst.GetHandler("script"));

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

Summary of changes:
 Source/CPack/cmCPackGenerator.cxx            |    2 +-
 Source/CPack/cpack.cxx                       |    4 +-
 Source/CTest/cmCTestBuildAndTestHandler.cxx  |    2 +-
 Source/CTest/cmCTestLaunch.cxx               |    2 +-
 Source/CTest/cmCTestScriptHandler.cxx        |    6 +--
 Source/CTest/cmCTestTestHandler.cxx          |    2 +-
 Source/CursesDialog/ccmake.cxx               |    2 +-
 Source/CursesDialog/cmCursesMainForm.cxx     |    2 +-
 Source/QtDialog/CMakeSetup.cxx               |    2 +-
 Source/QtDialog/QCMake.cxx                   |    2 +-
 Source/cmBreakCommand.h                      |    5 ---
 Source/cmBuildNameCommand.h                  |    1 -
 Source/cmCMakeHostSystemInformationCommand.h |    5 ---
 Source/cmCMakeMinimumRequired.h              |    5 ---
 Source/cmCMakePolicyCommand.h                |    5 ---
 Source/cmCTest.cxx                           |    2 +-
 Source/cmCommand.h                           |    5 ---
 Source/cmCommands.cxx                        |   61 ++++++++++++++++++++++++++
 Source/cmCommands.h                          |    1 +
 Source/cmConfigureFileCommand.h              |    5 ---
 Source/cmContinueCommand.h                   |    5 ---
 Source/cmDisallowedCommand.h                 |    5 ---
 Source/cmExecProgramCommand.h                |    5 ---
 Source/cmExecuteProcessCommand.h             |    5 ---
 Source/cmFileCommand.h                       |    5 ---
 Source/cmFindLibraryCommand.h                |    5 ---
 Source/cmFindPackageCommand.h                |    5 ---
 Source/cmFindPathCommand.h                   |    5 ---
 Source/cmFindProgramCommand.h                |    5 ---
 Source/cmForEachCommand.h                    |    5 ---
 Source/cmFunctionCommand.cxx                 |    5 ---
 Source/cmFunctionCommand.h                   |    5 ---
 Source/cmGetCMakePropertyCommand.h           |    5 ---
 Source/cmGetDirectoryPropertyCommand.h       |    5 ---
 Source/cmGetFilenameComponentCommand.h       |    5 ---
 Source/cmGetPropertyCommand.h                |    5 ---
 Source/cmGlobalNinjaGenerator.cxx            |    2 +-
 Source/cmGraphVizWriter.cxx                  |    2 +-
 Source/cmIfCommand.h                         |    5 ---
 Source/cmIncludeCommand.h                    |    5 ---
 Source/cmListCommand.h                       |    5 ---
 Source/cmLocalNinjaGenerator.cxx             |    8 +++-
 Source/cmMacroCommand.cxx                    |    5 ---
 Source/cmMacroCommand.h                      |    5 ---
 Source/cmMakeDirectoryCommand.h              |    5 ---
 Source/cmMakefile.cxx                        |   17 +------
 Source/cmMarkAsAdvancedCommand.h             |    8 ----
 Source/cmMathCommand.h                       |    5 ---
 Source/cmMessageCommand.h                    |    5 ---
 Source/cmOptionCommand.h                     |    5 ---
 Source/cmParseArgumentsCommand.h             |    5 ---
 Source/cmQtAutoGenerators.cxx                |    2 +-
 Source/cmRemoveCommand.h                     |    5 ---
 Source/cmReturnCommand.h                     |    5 ---
 Source/cmSeparateArgumentsCommand.h          |    5 ---
 Source/cmServerProtocol.cxx                  |    2 +-
 Source/cmSetCommand.h                        |    5 ---
 Source/cmSetDirectoryPropertiesCommand.h     |    5 ---
 Source/cmSetPropertyCommand.h                |    5 ---
 Source/cmSiteNameCommand.h                   |    5 ---
 Source/cmState.cxx                           |   15 -------
 Source/cmState.h                             |    1 -
 Source/cmStringCommand.h                     |    5 ---
 Source/cmUnexpectedCommand.h                 |    2 -
 Source/cmUnsetCommand.h                      |    5 ---
 Source/cmUseMangledMesaCommand.h             |    1 -
 Source/cmVariableWatchCommand.h              |    5 ---
 Source/cmWhileCommand.h                      |    5 ---
 Source/cmWriteFileCommand.h                  |    5 ---
 Source/cmake.cxx                             |   17 +++++--
 Source/cmake.h                               |    9 +++-
 Source/cmakemain.cxx                         |    8 ++--
 Source/cmcmd.cxx                             |    4 +-
 Source/ctest.cxx                             |    6 ---
 Tests/RunCMake/Ninja/CommandConcat.cmake     |   14 ++++++
 Tests/RunCMake/Ninja/RunCMakeTest.cmake      |   10 +++++
 76 files changed, 137 insertions(+), 302 deletions(-)
 create mode 100644 Tests/RunCMake/Ninja/CommandConcat.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list