summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-07-10 17:52:41 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-07-10 17:52:41 (GMT)
commit8c641677e996bd2434233f37da39b34d9000a740 (patch)
treef8c96aef5e4b11ecbb777051a8beb2b5c78d24b9 /Source
parent15f21aa74c0b11e8d6b7eef010ed6067a09ed799 (diff)
downloadCMake-8c641677e996bd2434233f37da39b34d9000a740.zip
CMake-8c641677e996bd2434233f37da39b34d9000a740.tar.gz
CMake-8c641677e996bd2434233f37da39b34d9000a740.tar.bz2
ENH: some cleanup of get property commands
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx84
-rw-r--r--Source/cmMakefile.cxx73
2 files changed, 80 insertions, 77 deletions
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 278e2ae..0f0fcca 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -28,7 +28,6 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
return false;
}
- std::vector<std::string>::size_type cc;
std::vector<std::string>::const_iterator i = args.begin();
std::string variable = *i;
++i;
@@ -76,72 +75,7 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
// OK, now we have the directory to process, we just get the requested
// information out of it
- if ( *i == "VARIABLES" || *i == "CACHE_VARIABLES" )
- {
- int cacheonly = 0;
- if ( *i == "CACHE_VARIABLES" )
- {
- cacheonly = 1;
- }
- std::vector<std::string> vars = dir->GetDefinitions(cacheonly);
- for ( cc = 0; cc < vars.size(); cc ++ )
- {
- if ( cc > 0 )
- {
- output += ";";
- }
- output += vars[cc];
- }
- }
- else if ( *i == "MACROS" )
- {
- dir->GetListOfMacros(output);
- }
- else if ( *i == "DEFINITIONS" )
- {
- output = dir->GetDefineFlags();
- }
- else if ( *i == "INCLUDE_DIRECTORIES" )
- {
- std::vector<std::string>::iterator it;
- int first = 1;
- cmOStringStream str;
- for ( it = dir->GetIncludeDirectories().begin();
- it != dir->GetIncludeDirectories().end();
- ++ it )
- {
- if ( !first )
- {
- str << ";";
- }
- str << it->c_str();
- first = 0;
- }
- output = str.str();
- }
- else if ( *i == "INCLUDE_REGULAR_EXPRESSION" )
- {
- output = dir->GetIncludeRegularExpression();
- }
- else if ( *i == "LINK_DIRECTORIES" )
- {
- std::vector<std::string>::iterator it;
- int first = 1;
- cmOStringStream str;
- for ( it = dir->GetLinkDirectories().begin();
- it != dir->GetLinkDirectories().end();
- ++ it )
- {
- if ( !first )
- {
- str << ";";
- }
- str << it->c_str();
- first = 0;
- }
- output = str.str();
- }
- else if ( *i == "DEFINITION" )
+ if ( *i == "DEFINITION" )
{
++i;
if (i == args.end())
@@ -151,20 +85,16 @@ bool cmGetDirectoryPropertyCommand::InitialPass(
return false;
}
output = dir->GetSafeDefinition(i->c_str());
+ this->Makefile->AddDefinition(variable.c_str(), output.c_str());
}
- else
+
+ const char *prop = dir->GetProperty(i->c_str());
+ if (prop)
{
- const char *prop = dir->GetProperty(i->c_str());
- if (prop)
- {
- this->Makefile->AddDefinition(variable.c_str(), prop);
- return true;
- }
- this->Makefile->AddDefinition(variable.c_str(), "");
+ this->Makefile->AddDefinition(variable.c_str(), prop);
return true;
}
- this->Makefile->AddDefinition(variable.c_str(), output.c_str());
-
+ this->Makefile->AddDefinition(variable.c_str(), "");
return true;
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 0487313..fae8ad9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2614,6 +2614,79 @@ const char *cmMakefile::GetProperty(const char* prop,
this->SetProperty("LISTFILE_STACK",tmp.c_str());
}
+ // some other special properties sigh
+ std::string output = "";
+ if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
+ {
+ int cacheonly = 0;
+ if ( !strcmp("CACHE_VARIABLES",prop) )
+ {
+ cacheonly = 1;
+ }
+ std::vector<std::string> vars = this->GetDefinitions(cacheonly);
+ for (unsigned int cc = 0; cc < vars.size(); cc ++ )
+ {
+ if ( cc > 0 )
+ {
+ output += ";";
+ }
+ output += vars[cc];
+ }
+ this->SetProperty(prop, output.c_str());
+ }
+ else if (!strcmp("MACROS",prop))
+ {
+ this->GetListOfMacros(output);
+ this->SetProperty(prop, output.c_str());
+ }
+ else if (!strcmp("DEFINITIONS",prop))
+ {
+ output = this->GetDefineFlags();
+ this->SetProperty(prop, output.c_str());
+ }
+ else if (!strcmp("INCLUDE_DIRECTORIES",prop) )
+ {
+ std::vector<std::string>::iterator it;
+ int first = 1;
+ cmOStringStream str;
+ for ( it = this->GetIncludeDirectories().begin();
+ it != this->GetIncludeDirectories().end();
+ ++ it )
+ {
+ if ( !first )
+ {
+ str << ";";
+ }
+ str << it->c_str();
+ first = 0;
+ }
+ output = str.str();
+ this->SetProperty(prop, output.c_str());
+ }
+ else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) )
+ {
+ return this->GetIncludeRegularExpression();
+ }
+ else if (!strcmp("LINK_DIRECTORIES",prop))
+ {
+ std::vector<std::string>::iterator it;
+ int first = 1;
+ cmOStringStream str;
+ for ( it = this->GetLinkDirectories().begin();
+ it != this->GetLinkDirectories().end();
+ ++ it )
+ {
+ if ( !first )
+ {
+ str << ";";
+ }
+ str << it->c_str();
+ first = 0;
+ }
+ output = str.str();
+ this->SetProperty(prop, output.c_str());
+ }
+
bool chain = false;
const char *retVal =
this->Properties.GetPropertyValue(prop, scope, chain);