Add find-package mode, which does nothing yet
-add command line argument --find-package and handle it, i.e. call an empty function cmake::FindPackage() -add basic help Alex
This commit is contained in:
parent
b976e70063
commit
a91d662f46
|
@ -384,7 +384,9 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
|
|||
|
||||
// Decide whether to invoke the command.
|
||||
if(pcmd->GetEnabled() && !cmSystemTools::GetFatalErrorOccured() &&
|
||||
(!this->GetCMakeInstance()->GetScriptMode() || pcmd->IsScriptable()))
|
||||
(this->GetCMakeInstance()->GetFindPackageMode()
|
||||
|| !this->GetCMakeInstance()->GetScriptMode() || pcmd->IsScriptable()))
|
||||
|
||||
{
|
||||
// if trace is one, print out invoke information
|
||||
if(this->GetCMakeInstance()->GetTrace())
|
||||
|
|
|
@ -181,6 +181,7 @@ cmake::cmake()
|
|||
this->ProgressCallback = 0;
|
||||
this->ProgressCallbackClientData = 0;
|
||||
this->ScriptMode = false;
|
||||
this->FindPackageMode = false;
|
||||
|
||||
#ifdef CMAKE_BUILD_WITH_CMAKE
|
||||
this->VariableWatch = new cmVariableWatch;
|
||||
|
@ -353,6 +354,7 @@ void cmake::RemoveUnscriptableCommands()
|
|||
// Parse the args
|
||||
bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
||||
{
|
||||
bool findPackageMode = false;
|
||||
for(unsigned int i=1; i < args.size(); ++i)
|
||||
{
|
||||
std::string arg = args[i];
|
||||
|
@ -480,7 +482,17 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
|
|||
}
|
||||
this->ReadListFile(args, path.c_str());
|
||||
}
|
||||
else if (arg.find("--find-package",0) == 0)
|
||||
{
|
||||
findPackageMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (findPackageMode)
|
||||
{
|
||||
return this->FindPackage(args);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -532,6 +544,14 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||
{
|
||||
// create empty function for now, will be filled later
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Parse the args
|
||||
void cmake::SetArgs(const std::vector<std::string>& args,
|
||||
bool directoriesSetBefore)
|
||||
|
@ -604,6 +624,11 @@ void cmake::SetArgs(const std::vector<std::string>& args,
|
|||
// skip for now
|
||||
i++;
|
||||
}
|
||||
else if(arg.find("--find-package",0) == 0)
|
||||
{
|
||||
// skip for now
|
||||
i++;
|
||||
}
|
||||
else if(arg.find("-Wno-dev",0) == 0)
|
||||
{
|
||||
// skip for now
|
||||
|
|
|
@ -282,6 +282,9 @@ class cmake
|
|||
void SetScriptMode(bool mode) { this->ScriptMode = mode; }
|
||||
bool GetScriptMode() { return this->ScriptMode; }
|
||||
|
||||
void SetFindPackageMode(bool mode) {this->FindPackageMode = mode; }
|
||||
bool GetFindPackageMode() {return this->FindPackageMode;}
|
||||
|
||||
///! Debug the try compile stuff by not delelting the files
|
||||
bool GetDebugTryCompile(){return this->DebugTryCompile;}
|
||||
void DebugTryCompileOn(){this->DebugTryCompile = true;}
|
||||
|
@ -407,6 +410,7 @@ protected:
|
|||
|
||||
///! read in a cmake list file to initialize the cache
|
||||
void ReadListFile(const std::vector<std::string>& args, const char *path);
|
||||
bool FindPackage(const std::vector<std::string>& args);
|
||||
|
||||
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
|
||||
/// If it is set, truncate it to 50kb
|
||||
|
@ -461,6 +465,7 @@ private:
|
|||
bool Verbose;
|
||||
bool InTryCompile;
|
||||
bool ScriptMode;
|
||||
bool FindPackageMode;
|
||||
bool DebugOutput;
|
||||
bool Trace;
|
||||
bool WarnUninitialized;
|
||||
|
|
|
@ -102,6 +102,9 @@ static const char * cmDocumentationOptions[][3] =
|
|||
"No configure or generate step is performed and the cache is not"
|
||||
" modified. If variables are defined using -D, this must be done "
|
||||
"before the -P argument."},
|
||||
{"--find-package", "Run in pkg-config like mode.",
|
||||
"Search a package using find_package() and print the resulting flags "
|
||||
"to stdout. "},
|
||||
{"--graphviz=[file]", "Generate graphviz of dependencies.",
|
||||
"Generate a graphviz input file that will contain all the library and "
|
||||
"executable dependencies in the project."},
|
||||
|
@ -434,6 +437,7 @@ int do_cmake(int ac, char** av)
|
|||
bool list_help = false;
|
||||
bool view_only = false;
|
||||
bool script_mode = false;
|
||||
bool find_package_mode = false;
|
||||
std::vector<std::string> args;
|
||||
for(int i =0; i < ac; ++i)
|
||||
{
|
||||
|
@ -487,6 +491,12 @@ int do_cmake(int ac, char** av)
|
|||
args.push_back(av[i]);
|
||||
}
|
||||
}
|
||||
else if (!command && strncmp(av[i], "--find-package",
|
||||
strlen("--find-package")) == 0)
|
||||
{
|
||||
find_package_mode = true;
|
||||
args.push_back(av[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
args.push_back(av[i]);
|
||||
|
@ -511,7 +521,8 @@ int do_cmake(int ac, char** av)
|
|||
cmake cm;
|
||||
cmSystemTools::SetErrorCallback(cmakemainErrorCallback, (void *)&cm);
|
||||
cm.SetProgressCallback(cmakemainProgressCallback, (void *)&cm);
|
||||
cm.SetScriptMode(script_mode);
|
||||
cm.SetScriptMode(script_mode || find_package_mode);
|
||||
cm.SetFindPackageMode(find_package_mode);
|
||||
|
||||
int res = cm.Run(args, view_only);
|
||||
if ( list_cached || list_all_cached )
|
||||
|
|
Loading…
Reference in New Issue