diff options
author | Brad King <brad.king@kitware.com> | 2013-10-23 12:19:57 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-23 12:19:57 (GMT) |
commit | 8855bf53959331a290fe8947eb23afd719a52cf4 (patch) | |
tree | 66b34b980fbceb5616d6c3f26056d153d7da4ba0 /Source | |
parent | 078530b4481e0f311e9180bf02cded228809076d (diff) | |
parent | 6c9194488aa5d61774ffeb40f54149ce2255f00c (diff) | |
download | CMake-8855bf53959331a290fe8947eb23afd719a52cf4.zip CMake-8855bf53959331a290fe8947eb23afd719a52cf4.tar.gz CMake-8855bf53959331a290fe8947eb23afd719a52cf4.tar.bz2 |
Merge topic 'remove-old-commands-by-policy'
6c91944 Add policy CMP0036 to disallow build_name
3969bb2 Add policy CMP0035 to disallow variable_requires
178b9af Add policy CMP0034 to disallow utility_source
248d1dc Add policy CMP0033 to disallow export_library_dependencies
6865c8f Add policy CMP0032 to disallow output_required_files
aa76518 Add policy CMP0031 to disallow load_command
97268cf Add policy CMP0030 to disallow use_mangled_mesa
9f64fbf Add policy CMP0029 to disallow subdir_depends
882c0f0 Add infrastructure for policies that disallow commands
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmBuildNameCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmBuildNameCommand.h | 38 | ||||
-rw-r--r-- | Source/cmCommand.h | 19 | ||||
-rw-r--r-- | Source/cmExportLibraryDependencies.cxx | 4 | ||||
-rw-r--r-- | Source/cmExportLibraryDependencies.h | 39 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.h | 24 | ||||
-rw-r--r-- | Source/cmOutputRequiredFilesCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmOutputRequiredFilesCommand.h | 32 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 40 | ||||
-rw-r--r-- | Source/cmPolicies.h | 8 | ||||
-rw-r--r-- | Source/cmSubdirDependsCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmSubdirDependsCommand.h | 34 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.h | 39 | ||||
-rw-r--r-- | Source/cmUtilitySourceCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmUtilitySourceCommand.h | 39 | ||||
-rw-r--r-- | Source/cmVariableRequiresCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmVariableRequiresCommand.h | 31 |
19 files changed, 114 insertions, 256 deletions
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index f95a79e..e3528e1 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -17,6 +17,9 @@ bool cmBuildNameCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0036, + "The build_name command should not be called; see CMP0036.")) + { return true; } if(args.size() < 1 ) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index faeb3c0..2f7acde 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -14,46 +14,16 @@ #include "cmCommand.h" -/** \class cmBuildNameCommand - * \brief build_name command - * - * cmBuildNameCommand implements the build_name CMake command - */ class cmBuildNameCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmBuildNameCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + cmTypeMacro(cmBuildNameCommand, cmCommand); + virtual cmCommand* Clone() { return new cmBuildNameCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * This determines if the command is invoked when in script mode. - */ - virtual bool IsScriptable() const { return true; } - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const {return "build_name";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - - cmTypeMacro(cmBuildNameCommand, cmCommand); + virtual bool IsScriptable() const { return true; } + virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 83184a0..e148857 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -173,6 +173,25 @@ public: this->Error += e; } + /** Check if the command is disallowed by a policy. */ + bool Disallowed(cmPolicies::PolicyID pol, const char* e) + { + switch(this->Makefile->GetPolicyStatus(pol)) + { + case cmPolicies::WARN: + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, + this->Makefile->GetPolicies()->GetPolicyWarning(pol)); + case cmPolicies::OLD: + return false; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e); + break; + } + return true; + } + protected: cmMakefile* Makefile; cmCommandArgumentsHelper Helper; diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index e3b1626..064ffa3 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -21,6 +21,10 @@ bool cmExportLibraryDependenciesCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0033, + "The export_library_dependencies command should not be called; " + "see CMP0033.")) + { return true; } if(args.size() < 1 ) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index a384a7c..29b568f 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/Source/cmExportLibraryDependencies.h @@ -14,50 +14,19 @@ #include "cmCommand.h" -/** \class cmExportLibraryDependenciesCommand - * \brief Add a test to the lists of tests to run. - * - * cmExportLibraryDependenciesCommand adds a test to the list of tests to run - * - */ class cmExportLibraryDependenciesCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmExportLibraryDependenciesCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand); + virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); + virtual const char* GetName() const { return "export_library_dependencies";} + virtual bool IsDiscouraged() const { return true; } - /** - * This is called at the end after all the information - * specified by the command is accumulated. - */ virtual void FinalPass(); virtual bool HasFinalPass() const { return true; } - /** - * The name of the command as specified in CMakeList.txt. - */ - virtual const char* GetName() const { return "export_library_dependencies";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - - cmTypeMacro(cmExportLibraryDependenciesCommand, cmCommand); - private: std::string Filename; bool Append; diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 84dd299..21ee0fe 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -189,6 +189,9 @@ cmLoadedCommand::~cmLoadedCommand() bool cmLoadCommandCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0031, + "The load_command command should not be called; see CMP0031.")) + { return true; } if(args.size() < 1 ) { return true; diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 918f32b..11bcf09 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -14,34 +14,14 @@ #include "cmCommand.h" -/** \class cmLoadCommandCommand - * \brief Load in a Command plugin - * - * cmLoadCommandCommand loads a command into CMake - */ class cmLoadCommandCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmLoadCommandCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + virtual cmCommand* Clone() { return new cmLoadCommandCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const {return "load_command";} - + virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index 01fc2cf..16b2bea 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -174,6 +174,9 @@ void cmLBDepend::DependWalk(cmDependInformation* info) bool cmOutputRequiredFilesCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0032, + "The output_required_files command should not be called; see CMP0032.")) + { return true; } if(args.size() != 2 ) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index d43b229..dd5ed6c 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -15,45 +15,19 @@ #include "cmCommand.h" #include "cmMakeDepend.h" -/** \class cmOutputRequiredFilesCommand - * \brief Output a list of required files for a source file - * - */ class cmOutputRequiredFilesCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmOutputRequiredFilesCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand); + virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "output_required_files";} + virtual bool IsDiscouraged() const { return true; } - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - - - cmTypeMacro(cmOutputRequiredFilesCommand, cmCommand); void ListDependencies(cmDependInformation const *info, FILE *fout, std::set<cmDependInformation const*> *visited); - private: std::string File; std::string OutputFile; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index f7efc1e..c05de17 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -246,6 +246,46 @@ cmPolicies::cmPolicies() CMP0028, "CMP0028", "Double colon in target name means ALIAS or IMPORTED target.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0029, "CMP0029", + "The subdir_depends command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0030, "CMP0030", + "The use_mangled_mesa command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0031, "CMP0031", + "The load_command command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0032, "CMP0032", + "The output_required_files command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0033, "CMP0033", + "The export_library_dependencies command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0034, "CMP0034", + "The utility_source command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0035, "CMP0035", + "The variable_requires command should not be called.", + 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0036, "CMP0036", + "The build_name command should not be called.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 68cd7c2..9e72bdc 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -80,6 +80,14 @@ public: CMP0027, ///< Conditionally linked imported targets with missing include /// directories. CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target. + CMP0029, ///< Disallow command: subdir_depends + CMP0030, ///< Disallow command: use_mangled_mesa + CMP0031, ///< Disallow command: load_command + CMP0032, ///< Disallow command: output_required_files + CMP0033, ///< Disallow command: export_library_dependencies + CMP0034, ///< Disallow command: utility_source + CMP0035, ///< Disallow command: variable_requires + CMP0036, ///< Disallow command: build_name /** \brief Always the last entry. * diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index 2af7bf1..9381983 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -11,10 +11,10 @@ ============================================================================*/ #include "cmSubdirDependsCommand.h" -// cmSubdirDependsCommand bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const& , cmExecutionStatus &) { + this->Disallowed(cmPolicies::CMP0029, + "The subdir_depends command should not be called; see CMP0029."); return true; } - diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index e6f1f8f..f78cfb7 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -14,45 +14,15 @@ #include "cmCommand.h" -/** \class cmSubdirDependsCommand - * \brief Legacy command. Do not use. - * - * cmSubdirDependsCommand has been left in CMake for compatability with - * projects already using it. Its functionality in supporting parallel - * builds is now automatic. The command does not do anything. - */ class cmSubdirDependsCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmSubdirDependsCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + virtual cmCommand* Clone() { return new cmSubdirDependsCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "subdir_depends";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - + virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmSubdirDependsCommand, cmCommand); }; - - #endif diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 4c189e6..1bd579d 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -14,10 +14,12 @@ #include <cmsys/RegularExpression.hxx> -// cmUseMangledMesaCommand bool cmUseMangledMesaCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0030, + "The use_mangled_mesa command should not be called; see CMP0030.")) + { return true; } // expected two arguments: // arguement one: the full path to gl_mangle.h // arguement two : directory for output of edited headers diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index aac7814..dca75a5 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -14,54 +14,19 @@ #include "cmCommand.h" -#include "cmSourceFile.h" - -/** \class cmUseMangledMesaCommand - * \brief Create Tcl Wrappers for VTK classes. - * - * cmUseMangledMesaCommand is used to define a CMake variable include - * path location by specifying a file and list of directories. - */ class cmUseMangledMesaCommand : public cmCommand { public: cmTypeMacro(cmUseMangledMesaCommand, cmCommand); - - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmUseMangledMesaCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "use_mangled_mesa";} - - /** - * This determines if the command is invoked when in script mode. - */ virtual bool IsScriptable() const { return true; } - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - + virtual bool IsDiscouraged() const { return true; } protected: void CopyAndFullPathMesaHeader(const char* source, const char* outdir); }; - #endif diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 6ea3dfa..11e5108 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -15,6 +15,9 @@ bool cmUtilitySourceCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0034, + "The utility_source command should not be called; see CMP0034.")) + { return true; } if(args.size() < 3) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 0a0653c..83d115c 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -14,48 +14,15 @@ #include "cmCommand.h" -/** \class cmUtilitySourceCommand - * \brief A command to setup a cache entry with the location of a third-party - * utility's source. - * - * cmUtilitySourceCommand is used when a third-party utility's source is - * included in the project's source tree. It specifies the location of - * the executable's source, and any files that may be needed to confirm the - * identity of the source. - */ class cmUtilitySourceCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmUtilitySourceCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + cmTypeMacro(cmUtilitySourceCommand, cmCommand); + virtual cmCommand* Clone() { return new cmUtilitySourceCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "utility_source";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - - - cmTypeMacro(cmUtilitySourceCommand, cmCommand); + virtual bool IsDiscouraged() const { return true; } }; - - #endif diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index 747e9be..ddb4003 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -16,6 +16,9 @@ bool cmVariableRequiresCommand ::InitialPass(std::vector<std::string>const& args, cmExecutionStatus &) { + if(this->Disallowed(cmPolicies::CMP0035, + "The variable_requires command should not be called; see CMP0035.")) + { return true; } if(args.size() < 3 ) { this->SetError("called with incorrect number of arguments"); diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 1032745..881b149 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -14,40 +14,15 @@ #include "cmCommand.h" -/** \class cmVariableRequiresCommand - * \brief Displays a message to the user - * - */ class cmVariableRequiresCommand : public cmCommand { public: - /** - * This is a virtual constructor for the command. - */ - virtual cmCommand* Clone() - { - return new cmVariableRequiresCommand; - } - - /** - * This is called when the command is first encountered in - * the CMakeLists.txt file. - */ + cmTypeMacro(cmVariableRequiresCommand, cmCommand); + virtual cmCommand* Clone() { return new cmVariableRequiresCommand; } virtual bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus &status); - - /** - * The name of the command as specified in CMakeList.txt. - */ virtual const char* GetName() const { return "variable_requires";} - - /** This command is kept for compatibility with older CMake versions. */ - virtual bool IsDiscouraged() const - { - return true; - } - - cmTypeMacro(cmVariableRequiresCommand, cmCommand); + virtual bool IsDiscouraged() const { return true; } }; |