summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-07-16 17:26:56 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-07-16 17:26:56 (GMT)
commitfac86048102011265b6a2f968f74618c63f96582 (patch)
treeaabe6a945f47897cd125204fedff1706bc651d46
parent5bb94ce16635954f460edcacd5422bc8d53fb8c1 (diff)
downloadCMake-fac86048102011265b6a2f968f74618c63f96582.zip
CMake-fac86048102011265b6a2f968f74618c63f96582.tar.gz
CMake-fac86048102011265b6a2f968f74618c63f96582.tar.bz2
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
-rw-r--r--Source/cmMakefile.cxx65
-rw-r--r--Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt6
2 files changed, 36 insertions, 35 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 86d0e2e..7ed1f2b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2592,30 +2592,33 @@ const char *cmMakefile::GetProperty(const char* prop,
cmProperty::ScopeType scope)
{
// watch for specific properties
+ static std::string output;
+ output = "";
if (!strcmp("PARENT_DIRECTORY",prop))
{
- return this->LocalGenerator->GetParent()
+ output = this->LocalGenerator->GetParent()
->GetMakefile()->GetStartDirectory();
+ return output.c_str();
}
- // watch for specific properties
- if (!strcmp("LISTFILE_STACK",prop))
+ else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) )
{
- std::string tmp;
- for (std::deque<cmStdString>::iterator i = this->ListFileStack.begin();
+ output = this->GetIncludeRegularExpression();
+ 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)
{
if (i != this->ListFileStack.begin())
{
- tmp += ";";
+ output += ";";
}
- tmp += *i;
+ output += *i;
}
- this->SetProperty("LISTFILE_STACK",tmp.c_str());
+ return output.c_str();
}
-
- // some other special properties sigh
- std::string output = "";
- if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
+ else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop))
{
int cacheonly = 0;
if ( !strcmp("CACHE_VARIABLES",prop) )
@@ -2631,59 +2634,51 @@ const char *cmMakefile::GetProperty(const char* prop,
}
output += vars[cc];
}
- this->SetProperty(prop, output.c_str());
+ return output.c_str();
}
else if (!strcmp("MACROS",prop))
{
this->GetListOfMacros(output);
- this->SetProperty(prop, output.c_str());
+ return output.c_str();
}
else if (!strcmp("DEFINITIONS",prop))
{
output = this->GetDefineFlags();
- this->SetProperty(prop, output.c_str());
+ return 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 )
+ for (std::vector<std::string>::const_iterator
+ it = this->GetIncludeDirectories().begin();
+ it != this->GetIncludeDirectories().end();
+ ++ it )
{
- if ( !first )
+ if ( it != this->GetIncludeDirectories().begin())
{
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();
+ return output.c_str();
}
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 )
+ for (std::vector<std::string>::const_iterator
+ it = this->GetLinkDirectories().begin();
+ it != this->GetLinkDirectories().end();
+ ++ it )
{
- if ( !first )
+ if ( it != this->GetLinkDirectories().begin())
{
str << ";";
}
str << it->c_str();
- first = 0;
}
output = str.str();
- this->SetProperty(prop, output.c_str());
+ return output.c_str();
}
bool chain = false;
diff --git a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
index 175138b..b83991f 100644
--- a/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
+++ b/Tests/OutOfSource/OutOfSourceSubdir/CMakeLists.txt
@@ -46,3 +46,9 @@ ENDIF ("${PROJECT_SOURCE_DIR}" STREQUAL "${ANOTHER_PROJ_SOURCE_DIR}")
# test getting a definition from a subdir
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)