summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmFindFileCommand.cxx26
-rw-r--r--Source/cmFindFileCommand.h6
-rw-r--r--Source/cmFindLibraryCommand.cxx55
-rw-r--r--Source/cmFindLibraryCommand.h6
-rw-r--r--Source/cmFindPathCommand.cxx23
-rw-r--r--Source/cmFindPathCommand.h4
-rw-r--r--Source/cmFindProgramCommand.cxx23
-rw-r--r--Source/cmFindProgramCommand.h6
8 files changed, 115 insertions, 34 deletions
diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx
index d919788..71f73a8 100644
--- a/Source/cmFindFileCommand.cxx
+++ b/Source/cmFindFileCommand.cxx
@@ -45,22 +45,38 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// cmFindFileCommand
-bool cmFindFileCommand::InitialPass(std::vector<std::string> const& args)
+bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
{
- if(args.size() < 2)
+ if(argsIn.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
}
-
+ std::string helpString = "Where can the ";
+ helpString += argsIn[1] + " file be found";
+ unsigned int size = argsIn.size();
+ std::vector<std::string> args;
+ for(unsigned int j = 0; j < size; ++j)
+ {
+ if(argsIn[j] != "DOC")
+ {
+ args.push_back(argsIn[j]);
+ }
+ else
+ {
+ if(j+1 < size)
+ {
+ helpString = argsIn[j+1];
+ }
+ break;
+ }
+ }
std::vector<std::string>::const_iterator i = args.begin();
// Use the first argument as the name of something to be defined
const char* define = (*i).c_str();
i++; // move iterator to next arg
// 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
- std::string helpString = "Where can the ";
- helpString += args[1] + " file be found";
const char* cacheValue
= m_Makefile->GetDefinition(define);
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index d245fa7..9d5fc90 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -94,7 +94,11 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "FIND_FILE(NAME file extrapath extrapath ...)";
+ "FIND_FILE(NAME file extrapath extrapath ... [DOC docstring])"
+ "Find a file in the system PATH or in any extra paths specified in the command."
+ "A cache entry called NAME is created to store the result. NOTFOUND is the value"
+ " used if the file was not found. If DOC is specified the next argument is the "
+ "documentation string for the cache entry NAME.";
}
cmTypeMacro(cmFindFileCommand, cmCommand);
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 5e374f2..36075e9 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -44,11 +44,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// cmFindLibraryCommand
bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
{
- std::vector<std::string> args = argsIn;
- if(args.size() < 2)
+ if(argsIn.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
+ }
+ std::string helpString;
+ unsigned int size = argsIn.size();
+ std::vector<std::string> args;
+ for(unsigned int j = 0; j < size; ++j)
+ {
+ if(argsIn[j] != "DOC")
+ {
+ args.push_back(argsIn[j]);
+ }
+ else
+ {
+ if(j+1 < size)
+ {
+ helpString = argsIn[j+1];
+ }
+ break;
+ }
}
std::vector<std::string> path;
@@ -101,26 +118,28 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
cmSystemTools::GlobDirs(exp.c_str(), path);
}
}
-
- std::string helpString = "Where can ";
- if (names.size() == 0)
- {
- helpString += "the (unknown) library be found";
- }
- else if (names.size() == 1)
+ if(helpString.size() == 0)
{
- helpString += "the " + names[0] + " library be found";
- }
- else
- {
- helpString += "one of the " + names[0];
- for (unsigned int j = 1; j < names.size() - 1; ++j)
+ helpString = "Where can ";
+ if (names.size() == 0)
+ {
+ helpString += "the (unknown) library be found";
+ }
+ else if (names.size() == 1)
+ {
+ helpString += "the " + names[0] + " library be found";
+ }
+ else
{
- helpString += ", " + names[j];
+ helpString += "one of the " + names[0];
+ for (unsigned int j = 1; j < names.size() - 1; ++j)
+ {
+ helpString += ", " + names[j];
+ }
+ helpString += " or " + names[names.size() - 1] + " libraries be found";
}
- helpString += " or " + names[names.size() - 1] + " libraries be found";
}
-
+
const char* cacheValue
= m_Makefile->GetDefinition(args[0].c_str());
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index cd275b2..df738f2 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -94,8 +94,10 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "FIND_LIBRARY(DEFINE_PATH libraryName [NAMES] name1 name2 name3 [PATHS path1 path2 path3...])\n"
- "If the library is found, then DEFINE_PATH is set to the full path where it was found";
+ "FIND_LIBRARY(DEFINE_PATH libraryName [NAMES] name1 name2 name3 [PATHS path1 path2 path3...] [DOC docstring] )\n"
+ "If the library is found, then DEFINE_PATH is set to the full path where it was found. "
+ "If DOC is specified the next argument is the "
+ "documentation string for the cache entry NAME.";
}
cmTypeMacro(cmFindLibraryCommand, cmCommand);
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index c4abd46..2a65e84 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cmCacheManager.h"
// cmFindPathCommand
-bool cmFindPathCommand::InitialPass(std::vector<std::string> const& args)
+bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
{
- if(args.size() < 2)
+ if(argsIn.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
@@ -53,7 +53,24 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& args)
// 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
std::string helpString = "What is the path where the file ";
- helpString += args[1] + " can be found";
+ helpString += argsIn[1] + " can be found";
+ std::vector<std::string> args;
+ unsigned int size = argsIn.size();
+ for(unsigned int j = 0; j < size; ++j)
+ {
+ if(argsIn[j] != "DOC")
+ {
+ args.push_back(argsIn[j]);
+ }
+ else
+ {
+ if(j+1 < size)
+ {
+ helpString = argsIn[j+1];
+ }
+ break;
+ }
+ }
const char* cacheValue
= m_Makefile->GetDefinition(args[0].c_str());
if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 048fc75..c8c10df 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -70,7 +70,9 @@ public:
{
return
"FIND_PATH(PATH_DEFINE fileName path1 path2 path3...)\n"
- "If the file is found, then PATH_DEFINE is set to the path where it was found";
+ "If the file is found, then PATH_DEFINE is set to the path where it was found."
+ "If DOC is specified the next argument is the "
+ "documentation string for the cache entry NAME.";
}
cmTypeMacro(cmFindPathCommand, cmCommand);
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index e6c7edc..df21da4 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -52,7 +52,24 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
this->SetError("called with incorrect number of arguments");
return false;
}
- std::vector<std::string> args = argsIn;
+ std::string doc = "Path to a program.";
+ unsigned int size = argsIn.size();
+ std::vector<std::string> args;
+ for(unsigned int j = 0; j < size; ++j)
+ {
+ if(argsIn[j] != "DOC")
+ {
+ args.push_back(argsIn[j]);
+ }
+ else
+ {
+ if(j+1 < size)
+ {
+ doc = argsIn[j+1];
+ }
+ break;
+ }
+ }
std::vector<std::string>::iterator i = args.begin();
// Use the first argument as the name of something to be defined
const char* define = (*i).c_str();
@@ -125,7 +142,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
// Save the value in the cache
m_Makefile->AddCacheDefinition(define,
result.c_str(),
- "Path to a program.",
+ doc.c_str(),
cmCacheManager::FILEPATH);
return true;
@@ -133,7 +150,7 @@ bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
}
m_Makefile->AddCacheDefinition(args[0].c_str(),
"NOTFOUND",
- "Path to a program",
+ doc.c_str(),
cmCacheManager::FILEPATH);
return true;
}
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index 060fb10..b270199 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -94,7 +94,11 @@ public:
virtual const char* GetFullDocumentation()
{
return
- "FIND_PROGRAM(NAME executable1 extrapath extrapath ...)";
+ "FIND_PROGRAM(NAME executable1 extrapath extrapath ... [DOC helpstring]) "
+ "Find the executable in the system PATH or in any extra paths specified in the command."
+ "A cache entry called NAME is created to store the result. NOTFOUND is the value"
+ " used if the program was not found. If DOC is specified the next argument is the "
+ "documentation string for the cache entry NAME.";
}
cmTypeMacro(cmFindProgramCommand, cmCommand);