summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-07-02 15:50:05 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-07-02 15:50:05 (GMT)
commita91d662f46fd2781fc5a3b73c2d244ac6dc2a343 (patch)
tree07f0f8c48d755ec9676defc742bbaf64d348f5be /Source
parentb976e70063008c0633cb5dd4ecb1f40278c67935 (diff)
downloadCMake-a91d662f46fd2781fc5a3b73c2d244ac6dc2a343.zip
CMake-a91d662f46fd2781fc5a3b73c2d244ac6dc2a343.tar.gz
CMake-a91d662f46fd2781fc5a3b73c2d244ac6dc2a343.tar.bz2
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
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx4
-rw-r--r--Source/cmake.cxx25
-rw-r--r--Source/cmake.h5
-rw-r--r--Source/cmakemain.cxx13
4 files changed, 45 insertions, 2 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 63bf03b..163145e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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())
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 45927cb..3d42c7f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -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
diff --git a/Source/cmake.h b/Source/cmake.h
index fac86c1..7335813 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -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;
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 663ce8f..ae4529a 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -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 )