BUG: GET_DIRECTORY_PROPERTY(INCLUDE_DIRECTORIES|LINK_DIRECTORIES) wasn't

working, for both the result was always empty, since
cmMakefile::GetProperty() recognized it as a special property, constructed a
correct return value and called cmMakefile::SetProperty() with this list of
directories, which then didn't actually set the property, but applied it to
the internal vector of include/link directories. The following
getPropertyValue in cmMakefile::GetProperty() then still didn't find it and
returned nothing. Now for all special property the static string output is
used and its content is returned. I'm not sure it is the right way to fix
this problem but at least it seems to work and it fixes the Paraview3 build

Alex
This commit is contained in:
Alexander Neundorf 2007-07-16 13:26:56 -04:00
parent 5bb94ce166
commit fac8604810
2 changed files with 36 additions and 35 deletions

View File

@ -2592,30 +2592,33 @@ const char *cmMakefile::GetProperty(const char* prop,
cmProperty::ScopeType scope) cmProperty::ScopeType scope)
{ {
// watch for specific properties // watch for specific properties
static std::string output;
output = "";
if (!strcmp("PARENT_DIRECTORY",prop)) if (!strcmp("PARENT_DIRECTORY",prop))
{ {
return this->LocalGenerator->GetParent() output = this->LocalGenerator->GetParent()
->GetMakefile()->GetStartDirectory(); ->GetMakefile()->GetStartDirectory();
return output.c_str();
} }
// watch for specific properties else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) )
if (!strcmp("LISTFILE_STACK",prop))
{ {
std::string tmp; output = this->GetIncludeRegularExpression();
for (std::deque<cmStdString>::iterator i = this->ListFileStack.begin(); return output.c_str();
}
else if (!strcmp("LISTFILE_STACK",prop))
{
for (std::deque<cmStdString>::const_iterator i = this->ListFileStack.begin();
i != this->ListFileStack.end(); ++i) i != this->ListFileStack.end(); ++i)
{ {
if (i != this->ListFileStack.begin()) if (i != this->ListFileStack.begin())
{ {
tmp += ";"; output += ";";
} }
tmp += *i; output += *i;
} }
this->SetProperty("LISTFILE_STACK",tmp.c_str()); return output.c_str();
} }
else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
// some other special properties sigh
std::string output = "";
if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
{ {
int cacheonly = 0; int cacheonly = 0;
if ( !strcmp("CACHE_VARIABLES",prop) ) if ( !strcmp("CACHE_VARIABLES",prop) )
@ -2631,59 +2634,51 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
output += vars[cc]; output += vars[cc];
} }
this->SetProperty(prop, output.c_str()); return output.c_str();
} }
else if (!strcmp("MACROS",prop)) else if (!strcmp("MACROS",prop))
{ {
this->GetListOfMacros(output); this->GetListOfMacros(output);
this->SetProperty(prop, output.c_str()); return output.c_str();
} }
else if (!strcmp("DEFINITIONS",prop)) else if (!strcmp("DEFINITIONS",prop))
{ {
output = this->GetDefineFlags(); output = this->GetDefineFlags();
this->SetProperty(prop, output.c_str()); return output.c_str();
} }
else if (!strcmp("INCLUDE_DIRECTORIES",prop) ) else if (!strcmp("INCLUDE_DIRECTORIES",prop) )
{ {
std::vector<std::string>::iterator it;
int first = 1;
cmOStringStream str; cmOStringStream str;
for ( it = this->GetIncludeDirectories().begin(); for (std::vector<std::string>::const_iterator
it != this->GetIncludeDirectories().end(); it = this->GetIncludeDirectories().begin();
++ it ) it != this->GetIncludeDirectories().end();
++ it )
{ {
if ( !first ) if ( it != this->GetIncludeDirectories().begin())
{ {
str << ";"; str << ";";
} }
str << it->c_str(); str << it->c_str();
first = 0;
} }
output = str.str(); output = str.str();
this->SetProperty(prop, output.c_str()); return output.c_str();
}
else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) )
{
return this->GetIncludeRegularExpression();
} }
else if (!strcmp("LINK_DIRECTORIES",prop)) else if (!strcmp("LINK_DIRECTORIES",prop))
{ {
std::vector<std::string>::iterator it;
int first = 1;
cmOStringStream str; cmOStringStream str;
for ( it = this->GetLinkDirectories().begin(); for (std::vector<std::string>::const_iterator
it != this->GetLinkDirectories().end(); it = this->GetLinkDirectories().begin();
++ it ) it != this->GetLinkDirectories().end();
++ it )
{ {
if ( !first ) if ( it != this->GetLinkDirectories().begin())
{ {
str << ";"; str << ";";
} }
str << it->c_str(); str << it->c_str();
first = 0;
} }
output = str.str(); output = str.str();
this->SetProperty(prop, output.c_str()); return output.c_str();
} }
bool chain = false; bool chain = false;

View File

@ -46,3 +46,9 @@ ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
# test getting a definition from a subdir # test getting a definition from a subdir
SET (WEASELS SIZZLING) SET (WEASELS SIZZLING)
GET_DIRECTORY_PROPERTY(incDirs INCLUDE_DIRECTORIES)
message(STATUS "incDirs: -${incDirs}")
IF(NOT incDirs)
MESSAGE(FATAL_ERROR "GET_DIRECTORY_PROPERTY(INCLUDE_DIRECTORIES) returned empty list")
ENDIF(NOT incDirs)