BUG: fix 6647 arguments after -E should not be parsed by CMake
This commit is contained in:
parent
d2e2ab72bf
commit
d632b96841
|
@ -656,7 +656,8 @@ cmDocumentation::Form cmDocumentation::GetFormFromFilename(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmDocumentation::CheckOptions(int argc, const char* const* argv)
|
||||
bool cmDocumentation::CheckOptions(int argc, const char* const* argv,
|
||||
const char* exitOpt)
|
||||
{
|
||||
// Providing zero arguments gives usage information.
|
||||
if(argc == 1)
|
||||
|
@ -673,6 +674,10 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv)
|
|||
bool result = false;
|
||||
for(int i=1; i < argc; ++i)
|
||||
{
|
||||
if(exitOpt && strcmp(argv[i], exitOpt) == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
RequestedHelpItem help;
|
||||
// Check if this is a supported help option.
|
||||
if((strcmp(argv[i], "-help") == 0) ||
|
||||
|
|
|
@ -45,9 +45,12 @@ public:
|
|||
* Check command line arguments for documentation options. Returns
|
||||
* true if documentation options are found, and false otherwise.
|
||||
* When true is returned, PrintRequestedDocumentation should be
|
||||
* called.
|
||||
* called. exitOpt can be used for things like cmake -E, so that
|
||||
* all arguments after the -E are ignored and not searched for
|
||||
* help arguments.
|
||||
*/
|
||||
bool CheckOptions(int argc, const char* const* argv);
|
||||
bool CheckOptions(int argc, const char* const* argv,
|
||||
const char* exitOpt =0);
|
||||
|
||||
/**
|
||||
* Print help requested on the command line. Call after
|
||||
|
|
|
@ -314,7 +314,7 @@ int do_cmake(int ac, char** av)
|
|||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
cmDocumentation doc;
|
||||
if(doc.CheckOptions(ac, av) || nocwd)
|
||||
if(doc.CheckOptions(ac, av, "-E") || nocwd)
|
||||
{
|
||||
// Construct and print requested documentation.
|
||||
cmake hcm;
|
||||
|
@ -416,29 +416,29 @@ int do_cmake(int ac, char** av)
|
|||
{
|
||||
command = true;
|
||||
}
|
||||
else if (strcmp(av[i], "-N") == 0)
|
||||
else if (!command && strcmp(av[i], "-N") == 0)
|
||||
{
|
||||
view_only = true;
|
||||
}
|
||||
else if (strcmp(av[i], "-L") == 0)
|
||||
else if (!command && strcmp(av[i], "-L") == 0)
|
||||
{
|
||||
list_cached = true;
|
||||
}
|
||||
else if (strcmp(av[i], "-LA") == 0)
|
||||
else if (!command && strcmp(av[i], "-LA") == 0)
|
||||
{
|
||||
list_all_cached = true;
|
||||
}
|
||||
else if (strcmp(av[i], "-LH") == 0)
|
||||
else if (!command && strcmp(av[i], "-LH") == 0)
|
||||
{
|
||||
list_cached = true;
|
||||
list_help = true;
|
||||
}
|
||||
else if (strcmp(av[i], "-LAH") == 0)
|
||||
else if (!command && strcmp(av[i], "-LAH") == 0)
|
||||
{
|
||||
list_all_cached = true;
|
||||
list_help = true;
|
||||
}
|
||||
else if (strncmp(av[i], "-P", strlen("-P")) == 0)
|
||||
else if (!command && strncmp(av[i], "-P", strlen("-P")) == 0)
|
||||
{
|
||||
if ( i == ac -1 )
|
||||
{
|
||||
|
@ -457,7 +457,6 @@ int do_cmake(int ac, char** av)
|
|||
args.push_back(av[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(command)
|
||||
{
|
||||
int ret = cmake::ExecuteCMakeCommand(args);
|
||||
|
|
Loading…
Reference in New Issue