Commit 58017118 authored by David Cole's avatar David Cole Committed by Kitware Robot

Merge topic 'target-include-directories'

d662dff7 Fix shadowed variable warning on dashboard results
f66e735d Fix compiler warning reported on older Borland dashboard.
d90eed44 Fix compiler error reported on older Borland dashboard.
8233636d Update the documentation regarding INCLUDE_DIRECTORIES.
d899eb71 Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
c21db870 Make search paths ordered and unique
22021f07 Remove cmMakefile::GetIncludeDirectories
9106b564 Extract and use the INCLUDE_DIRECTORIES target properties.
840509ba Keep the INCLUDE_DIRECTORIES target property up to date.
a4d5f7b9 Add API to get the ordered includes for a target.
8adaee2b CMake: Eliminate cmMakefile::IncludeDirectories
7620932d Remove include flags memoization.
97a5faa8 Make it safe to call this method without creating duplicates.
edd53039 Refactor GetIncludeFlags to take includes instead of fetching them
parents 3a36fa99 d662dff7
......@@ -260,12 +260,27 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
//----------------------------------------------------------------------------
void cmDepends::SetIncludePathFromLanguage(const char* lang)
{
// Look for the new per "TARGET_" variant first:
const char * includePath = 0;
std::string includePathVar = "CMAKE_";
includePathVar += lang;
includePathVar += "_INCLUDE_PATH";
includePathVar += "_TARGET_INCLUDE_PATH";
cmMakefile* mf = this->LocalGenerator->GetMakefile();
if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
includePath = mf->GetDefinition(includePathVar.c_str());
if(includePath)
{
cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
}
else
{
// Fallback to the old directory level variable if no per-target var:
includePathVar = "CMAKE_";
includePathVar += lang;
includePathVar += "_INCLUDE_PATH";
includePath = mf->GetDefinition(includePathVar.c_str());
if(includePath)
{
cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
}
}
}
......@@ -596,16 +596,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
// the include directories for this target
std::set<std::string> uniqIncludeDirs;
const std::vector<std::string>& incDirs =
target->GetMakefile()->GetIncludeDirectories();
for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
dirIt != incDirs.end();
std::vector<std::string> includes;
target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, target);
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
dirIt != includes.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty())
......
......@@ -893,9 +893,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end();
++it)
{
const std::vector<std::string>& includeDirs
= (*it)->GetMakefile()->GetIncludeDirectories();
this->AppendIncludeDirectories(fout, includeDirs, emmited);
cmTargets & targets = (*it)->GetMakefile()->GetTargets();
for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
{
std::vector<std::string> includeDirs;
(*it)->GetIncludeDirectories(includeDirs, &l->second);
this->AppendIncludeDirectories(fout, includeDirs, emmited);
}
}
// now also the system include directories, in case we found them in
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
......
......@@ -1067,9 +1067,9 @@ void cmGlobalGenerator::CheckLocalGenerators()
{
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
this->LocalGenerators[i]->ConfigureFinalPass();
const cmTargets & targets =
cmTargets & targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets();
for (cmTargets::const_iterator l = targets.begin();
for (cmTargets::iterator l = targets.begin();
l != targets.end(); l++)
{
const cmTarget::LinkLibraryVectorType& libs =
......@@ -1095,27 +1095,28 @@ void cmGlobalGenerator::CheckLocalGenerators()
notFoundMap[varName] = text;
}
}
}
const std::vector<std::string>& incs =
this->LocalGenerators[i]->GetMakefile()->GetIncludeDirectories();
std::vector<std::string> incs;
this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second);
for( std::vector<std::string>::const_iterator incDir = incs.begin();
incDir != incs.end(); ++incDir)
{
if(incDir->size() > 9 &&
cmSystemTools::IsNOTFOUND(incDir->c_str()))
for( std::vector<std::string>::const_iterator incDir = incs.begin();
incDir != incs.end(); ++incDir)
{
std::string varName = incDir->substr(0, incDir->size()-9);
cmCacheManager::CacheIterator it =
manager->GetCacheIterator(varName.c_str());
if(it.GetPropertyAsBool("ADVANCED"))
if(incDir->size() > 9 &&
cmSystemTools::IsNOTFOUND(incDir->c_str()))
{
varName += " (ADVANCED)";
std::string varName = incDir->substr(0, incDir->size()-9);
cmCacheManager::CacheIterator it =
manager->GetCacheIterator(varName.c_str());
if(it.GetPropertyAsBool("ADVANCED"))
{
varName += " (ADVANCED)";
}
std::string text = notFoundMap[varName];
text += "\n used as include directory in directory ";
text += this->LocalGenerators[i]
->GetMakefile()->GetCurrentDirectory();
notFoundMap[varName] = text;
}
std::string text = notFoundMap[varName];
text += "\n used as include directory in directory ";
text += this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
notFoundMap[varName] = text;
}
}
this->CMakeInstance->UpdateProgress
......
......@@ -1811,7 +1811,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes);
this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target);
std::set<cmStdString> emitted;
emitted.insert("/System/Library/Frameworks");
for(std::vector<std::string>::iterator i = includes.begin();
......
......@@ -58,13 +58,21 @@ public:
{
return
" include_directories([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)\n"
"Add the given directories to those searched by the compiler for "
"include files. By default the directories are appended onto "
"the current list of directories. This default behavior can be "
"changed by setting CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
"By using BEFORE or AFTER you can select between appending and "
"prepending, independent from the default. "
"If the SYSTEM option is given the compiler will be told that the "
"Add the given directories to those the compiler uses to search "
"for include files. "
"These directories are added to the directory property "
"INCLUDE_DIRECTORIES for the current CMakeLists file. "
"They are also added to the target property INCLUDE_DIRECTORIES "
"for each target in the current CMakeLists file. "
"The target property values are the ones used by the generators."
"\n"
"By default the directories are appended onto the current list of "
"directories. "
"This default behavior can be changed by setting "
"CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
"By using AFTER or BEFORE explicitly, you can select between "
"appending and prepending, independent of the default. "
"If the SYSTEM option is given, the compiler will be told the "
"directories are meant as system include directories on some "
"platforms.";
}
......
......@@ -556,7 +556,7 @@ void cmLocalGenerator::GenerateTargetManifest()
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
cmSourceFile& source,
cmTarget& )
cmTarget& target)
{
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
......@@ -574,7 +574,11 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
std::string flags;
flags += this->Makefile->GetSafeDefinition(varString.c_str());
flags += " ";
flags += this->GetIncludeFlags(lang);
{
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, &target, lang);
flags += this->GetIncludeFlags(includes, lang);
}
flags += this->Makefile->GetDefineFlags();
// Construct the command lines.
......@@ -1192,24 +1196,16 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
}
//----------------------------------------------------------------------------
const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
bool forResponseFile)
std::string cmLocalGenerator::GetIncludeFlags(
const std::vector<std::string> &includes,
const char* lang, bool forResponseFile)
{
if(!lang)
{
return "";
}
std::string key = lang;
key += forResponseFile? "@" : "";
if(this->LanguageToIncludeFlags.count(key))
{
return this->LanguageToIncludeFlags[key].c_str();
}
cmOStringStream includeFlags;
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, lang);
std::vector<std::string>::iterator i;
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
flagVar += lang;
......@@ -1251,6 +1247,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
#ifdef __APPLE__
emitted.insert("/System/Library/Frameworks");
#endif
std::vector<std::string>::const_iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
if(this->Makefile->IsOn("APPLE")
......@@ -1311,16 +1308,12 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
{
flags[flags.size()-1] = ' ';
}
this->LanguageToIncludeFlags[key] = flags;
// Use this temorary variable for the return value to work-around a
// bogus GCC 2.95 warning.
const char* ret = this->LanguageToIncludeFlags[key].c_str();
return ret;
return flags;
}
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmTarget* target,
const char* lang)
{
// Need to decide whether to automatically include the source and
......@@ -1375,8 +1368,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
// Store the automatic include paths.
if(includeBinaryDir)
{
dirs.push_back(this->Makefile->GetStartOutputDirectory());
emitted.insert(this->Makefile->GetStartOutputDirectory());
if(emitted.find(
this->Makefile->GetStartOutputDirectory()) == emitted.end())
{
dirs.push_back(this->Makefile->GetStartOutputDirectory());
emitted.insert(this->Makefile->GetStartOutputDirectory());
}
}
if(includeSourceDir)
{
......@@ -1402,9 +1399,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
}
// Get the project-specified include directories.
std::vector<std::string>& includes =
this->Makefile->GetIncludeDirectories();
// Get the target-specific include directories.
std::vector<std::string> includes;
if(target)
{
includes = target->GetIncludeDirectories();
}
// Support putting all the in-project include directories first if
// it is requested by the project.
......@@ -1412,7 +1412,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
{
const char* topSourceDir = this->Makefile->GetHomeDirectory();
const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
for(std::vector<std::string>::iterator i = includes.begin();
for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
// Emit this directory only if it is a subdirectory of the
......@@ -1431,7 +1431,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
}
// Construct the final ordered include directory list.
for(std::vector<std::string>::iterator i = includes.begin();
for(std::vector<std::string>::const_iterator i = includes.begin();
i != includes.end(); ++i)
{
if(emitted.insert(*i).second)
......
......@@ -146,8 +146,8 @@ public:
///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const char* newFlags);
///! Get the include flags for the current makefile and language
const char* GetIncludeFlags(const char* lang,
bool forResponseFile = false);
std::string GetIncludeFlags(const std::vector<std::string> &includes,
const char* lang, bool forResponseFile = false);
/**
* Encode a list of preprocessor definitions for the compiler
......@@ -198,6 +198,7 @@ public:
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs,
cmTarget* target,
const char* lang = "C");
/** Compute the language used to compile the given source file. */
......@@ -395,7 +396,6 @@ protected:
std::vector<std::string> StartOutputDirectoryComponents;
cmLocalGenerator* Parent;
std::vector<cmLocalGenerator*> Children;
std::map<cmStdString, cmStdString> LanguageToIncludeFlags;
std::map<cmStdString, cmStdString> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<cmStdString> ObjectMaxPathViolations;
......
......@@ -452,28 +452,6 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
<< "\n";
}
// Store the include search path for this directory.
infoFileStream
<< "# The C and CXX include file search paths:\n";
infoFileStream
<< "SET(CMAKE_C_INCLUDE_PATH\n";
std::vector<std::string> includeDirs;
this->GetIncludeDirectories(includeDirs);
for(std::vector<std::string>::iterator i = includeDirs.begin();
i != includeDirs.end(); ++i)
{
infoFileStream
<< " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n";
}
infoFileStream
<< " )\n";
infoFileStream
<< "SET(CMAKE_CXX_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
infoFileStream
<< "SET(CMAKE_Fortran_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
infoFileStream
<< "SET(CMAKE_ASM_INCLUDE_PATH ${CMAKE_C_INCLUDE_PATH})\n";
// Store the include regular expressions for this directory.
infoFileStream
<< "\n"
......
......@@ -103,52 +103,9 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
}
}
// Setup /I and /LIBPATH options for the resulting DSP file. VS 6
// truncates long include paths so make it as short as possible if
// the length threatens this problem.
unsigned int maxIncludeLength = 3000;
bool useShortPath = false;
for(int j=0; j < 2; ++j)
{
std::vector<std::string> includes;
this->GetIncludeDirectories(includes);
std::vector<std::string>::iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string tmp =
this->ConvertToOptionallyRelativeOutputPath(i->c_str());
if(useShortPath)
{
cmSystemTools::GetShortPath(tmp.c_str(), tmp);
}
this->IncludeOptions += " /I ";
// quote if not already quoted
if (tmp[0] != '"')
{
this->IncludeOptions += "\"";
this->IncludeOptions += tmp;
this->IncludeOptions += "\"";
}
else
{
this->IncludeOptions += tmp;
}
}
if(j == 0 && this->IncludeOptions.size() > maxIncludeLength)
{
this->IncludeOptions = "";
useShortPath = true;
}
else
{
break;
}
}
// Create the DSP or set of DSP's for libraries and executables
cmTargets &tgts = this->Makefile->GetTargets();
cmTargets &tgts = this->Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
......@@ -895,6 +852,61 @@ inline std::string removeQuotes(const std::string& s)
return s;
}
std::string
cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target)
{
std::string includeOptions;
// Setup /I and /LIBPATH options for the resulting DSP file. VS 6
// truncates long include paths so make it as short as possible if
// the length threatens this problem.
unsigned int maxIncludeLength = 3000;
bool useShortPath = false;
for(int j=0; j < 2; ++j)
{
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, &target);
std::vector<std::string>::iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string tmp =
this->ConvertToOptionallyRelativeOutputPath(i->c_str());
if(useShortPath)
{
cmSystemTools::GetShortPath(tmp.c_str(), tmp);
}
includeOptions += " /I ";
// quote if not already quoted
if (tmp[0] != '"')
{
includeOptions += "\"";
includeOptions += tmp;
includeOptions += "\"";
}
else
{
includeOptions += tmp;
}
}
if(j == 0 && includeOptions.size() > maxIncludeLength)
{
includeOptions = "";
useShortPath = true;
}
else
{
break;
}
}
return includeOptions;
}
// Code in blocks surrounded by a test for this definition is needed
// only for compatibility with user project's replacement DSP
// templates. The CMake templates no longer use them.
......@@ -1132,6 +1144,9 @@ void cmLocalVisualStudio6Generator
}
#endif
// Get include options for this target.
std::string includeOptions = this->GetTargetIncludeOptions(target);
// Get extra linker options for this target type.
std::string extraLinkOptions;
std::string extraLinkOptionsDebug;
......@@ -1510,7 +1525,7 @@ void cmLocalVisualStudio6Generator
optionsRelWithDebInfo.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
this->IncludeOptions.c_str());
includeOptions.c_str());
cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG",
targetVersionFlag.c_str());
cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG",
......
......@@ -89,7 +89,7 @@ private:
void ComputeLinkOptions(cmTarget& target, const char* configName,
const std::string extraOptions,
std::string& options);
std::string IncludeOptions;
std::string GetTargetIncludeOptions(cmTarget &target);
std::vector<std::string> Configurations;
std::string GetConfigName(std::string const& configuration) const;
......
......@@ -807,7 +807,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string> includes;
this->GetIncludeDirectories(includes);
this->GetIncludeDirectories(includes, &target);
std::vector<std::string>::iterator i = includes.begin();
for(;i != includes.end(); ++i)
{
......
......@@ -54,16 +54,33 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
this->Makefile->IncludeFileRegularExpression.c_str());
this->ComplainFileRegularExpression.compile(
this->Makefile->ComplainFileRegularExpression.c_str());
// Now extract any include paths from the makefile flags
const std::vector<std::string>& includes =
this->Makefile->GetIncludeDirectories();
for(std::vector<std::string>::const_iterator j = includes.begin();
j != includes.end(); ++j)
// Now extract any include paths from the targets
std::set<std::string> uniqueIncludes;
std::vector<std::string> orderedAndUniqueIncludes;
cmTargets & targets = this->Makefile->GetTargets();
for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
{
const std::vector<std::string>& includes =
l->second.GetIncludeDirectories();
for(std::vector<std::string>::const_iterator j = includes.begin();
j != includes.end(); ++j)
{
std::string path = *j;
this->Makefile->ExpandVariablesInString(path);
if(uniqueIncludes.insert(path).second)
{
orderedAndUniqueIncludes.push_back(path);
}
}
}
for(std::vector<std::string>::const_iterator
it = orderedAndUniqueIncludes.begin();
it != orderedAndUniqueIncludes.end();
++it)
{
std::string path = *j;
this->Makefile->ExpandVariablesInString(path);
this->AddSearchPath(path.c_str());
this->AddSearchPath(it->c_str());
}
}
......
......@@ -116,7 +116,6 @@ cmMakefile::cmMakefile(const cmMakefile& mf): Internal(new Internals)
this->Targets = mf.Targets;
this->SourceFiles = mf.SourceFiles;
this->Tests = mf.Tests;
this->IncludeDirectories = mf.IncludeDirectories;
this->LinkDirectories = mf.LinkDirectories;
this->SystemIncludeDirectories = mf.SystemIncludeDirectories;
this->ListFiles = mf.ListFiles;
......@@ -278,8 +277,6 @@ void cmMakefile::Print()
this->cmHomeDirectory.c_str() << std::endl;
std::cout << " this->ProjectName; "
<< this->ProjectName.c_str() << std::endl;
this->PrintStringVector("this->IncludeDirectories;",
this->IncludeDirectories);
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
#if defined(CMAKE_BUILD_WITH_CMAKE)
for( std::vector<cmSourceGroup>::const_iterator i =
......@@ -1478,7 +1475,8 @@ void cmMakefile::InitializeFromParent()
this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure();
// copy include paths
this->IncludeDirectories = parent->IncludeDirectories;
this->SetProperty("INCLUDE_DIRECTORIES",
parent->GetProperty("INCLUDE_DIRECTORIES"));
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
// define flags
......@@ -1603,42 +1601,61 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
}
}
void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
//----------------------------------------------------------------------------
void AddStringToProperty(cmProperty *prop, const char* name, const char* s,
bool before)
{
// if there is a newline then break it into multiple arguments
if (!inc)
if (!prop)
{
return;
}
// Don't add an include directory that is already present. Yes,
// this linear search results in n^2 behavior, but n won't be
// getting much bigger than 20. We cannot use a set because of
// order dependency of the include path.
std::vector<std::string>::iterator i =
std::find(this->IncludeDirectories.begin(),
this->IncludeDirectories.end(), inc);
if(i == this->IncludeDirectories.end())
// Don't worry about duplicates at this point. We eliminate them when
// we convert the property to a vector in GetIncludeDirectories.
if (before)
{
if (before)
const char *val = prop->GetValue();
cmOStringStream oss;
if(val && *val)
{
// WARNING: this *is* expensive (linear time) since it's a vector
this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc);
oss << s << ";" << val;
}
else
{
this->IncludeDirectories.push_back(inc);
oss << s;
}
std::string newVal = oss.str();
prop->Set(name, newVal.c_str());
}
else
{
if(before)
{
// if this before and already in the path then remove it
this->IncludeDirectories.erase(i);
// WARNING: this *is* expensive (linear time) since it's a vector
this->IncludeDirectories.insert(this->IncludeDirectories.begin(), inc);
}
prop->Append(name, s);
}
}
//----------------------------------------------------------------------------
void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
{
if (!inc)
{
return;
}
// Directory property:
cmProperty *prop =
this->GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES");
AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before);
// Property on each target:
for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
prop = t.GetProperties().GetOrCreateProperty("INCLUDE_DIRECTORIES");
AddStringToProperty(prop, "INCLUDE_DIRECTORIES", inc, before);
}
}
......@@ -2093,17 +2110,37 @@ void cmMakefile::AddExtraDirectory(const char* dir)
}
// expance CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
// expand CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR in the
// include and library directories.
void cmMakefile::ExpandVariables()
{
// Now expand variables in the include and link strings
for(std::vector<std::string>::iterator d = this->IncludeDirectories.begin();
d != this->IncludeDirectories.end(); ++d)
// May not be necessary anymore... But may need a policy for strict
// backwards compatibility
const char *includeDirs = this->GetProperty("INCLUDE_DIRECTORIES");
if (includeDirs)
{
this->ExpandVariablesInString(*d, true, true);
std::string dirs = includeDirs;
this->ExpandVariablesInString(dirs, true, true);
this->SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
}
// Also for each target's INCLUDE_DIRECTORIES property:
for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l)
{
cmTarget &t = l->second;
includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
if (includeDirs)
{
std::string dirs = includeDirs;
this->ExpandVariablesInString(dirs, true, true);
t.SetProperty("INCLUDE_DIRECTORIES", dirs.c_str());
}
}
for(std::vector<std::string>::iterator d = this->LinkDirectories.begin();
d != this->LinkDirectories.end(); ++d)
{
......@@ -3317,16 +3354,6 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
// handle special props
std::string propname = prop;
if ( propname == "INCLUDE_DIRECTORIES" )
{
std::vector<std::string> varArgsExpanded;
if(value)