From 0415b58573ba63a9c6168d8af05a165ea5e24774 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 17 Apr 2002 16:16:06 -0400 Subject: ENH: backwards compatible for VTK 4.0, add cmake version requires --- Source/cmOptionCommand.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'Source/cmOptionCommand.cxx') diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 2a943b85d7..4478a21fd8 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -19,12 +19,33 @@ // cmOptionCommand bool cmOptionCommand::InitialPass(std::vector const& args) { - if(args.size() < 2 || args.size() > 3) + bool argError = false; + if(args.size() < 2) { - this->SetError("called with incorrect number of arguments"); + argError = true; + } + // for VTK 4.0 we have to support the option command with more than 3 arguments + // if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if CMAKE_MINIMUM_REQUIRED_VERSION + // is defined, then we can have stricter checking. + if(m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) + { + if(args.size() > 3) + { + argError = true; + } + } + if(argError) + { + std::string m = "called with incorrect number of arguments: "; + for(int i =0; i < args.size(); ++i) + { + m += args[i]; + m += " "; + } + this->SetError(m.c_str()); return false; } - + // Now check and see if the value has been stored in the cache // already, if so use that value and don't look for the program const char* cacheValue -- cgit v1.2.1