summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-21 13:22:21 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-07-21 13:22:21 (GMT)
commite13c18974307ecd0f11e2ecfde64f1aea80c6304 (patch)
tree60edbb69fc1eba0f374b5f18c9f2865cfcf38723 /Source
parentae64efa1ce9097f27c1dbfb2b6a14ccf512e16b7 (diff)
parent881613c4abbbca35223678d6b17da418958a0005 (diff)
downloadCMake-e13c18974307ecd0f11e2ecfde64f1aea80c6304.zip
CMake-e13c18974307ecd0f11e2ecfde64f1aea80c6304.tar.gz
CMake-e13c18974307ecd0f11e2ecfde64f1aea80c6304.tar.bz2
Merge topic 'remove-special-LINK_DIRECTORIES-handling'
881613c4 cmMakefile: Remove special handling of LINK_DIRECTORIES property. 35734260 cmMakefile: Inline only use of GetLinkDirectories.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLinkDirectoriesCommand.cxx2
-rw-r--r--Source/cmMakefile.cxx93
-rw-r--r--Source/cmMakefile.h14
3 files changed, 30 insertions, 79 deletions
diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx
index f486bf7..b6c0072 100644
--- a/Source/cmLinkDirectoriesCommand.cxx
+++ b/Source/cmLinkDirectoriesCommand.cxx
@@ -65,5 +65,5 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir)
unixPath = tmp;
}
}
- this->Makefile->AddLinkDirectory(unixPath);
+ this->Makefile->AppendProperty("LINK_DIRECTORIES", unixPath.c_str());
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c68d8c9..cacca1f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1517,31 +1517,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib)
this->AddLinkLibrary(lib,cmTarget::GENERAL);
}
-void cmMakefile::AddLinkDirectory(const std::string& dir)
-{
- // Don't add a link 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 link search path.
-
- if(dir.empty())
- {
- return;
- }
- std::string newdir = dir;
- // remove trailing slashes
- if(*dir.rbegin() == '/')
- {
- newdir = dir.substr(0, dir.size()-1);
- }
- if(std::find(this->LinkDirectories.begin(),
- this->LinkDirectories.end(), newdir)
- == this->LinkDirectories.end())
- {
- this->LinkDirectories.push_back(dir);
- }
-}
-
void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
// Initialize definitions with the closure of the parent scope.
@@ -1604,7 +1579,8 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
this->LinkLibraries = parent->LinkLibraries;
// link directories
- this->LinkDirectories = parent->LinkDirectories;
+ this->SetProperty("LINK_DIRECTORIES",
+ parent->GetProperty("LINK_DIRECTORIES"));
// the initial project name
this->ProjectName = parent->ProjectName;
@@ -2140,11 +2116,26 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name,
return;
default:;
}
- std::vector<std::string>::iterator j;
- for(j = this->LinkDirectories.begin();
- j != this->LinkDirectories.end(); ++j)
+ if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES"))
{
- target.AddLinkDirectory(*j);
+ std::vector<std::string> linkDirs;
+ cmSystemTools::ExpandListArgument(linkDirsProp, linkDirs);
+
+ for(std::vector<std::string>::iterator j = linkDirs.begin();
+ j != linkDirs.end(); ++j)
+ {
+ std::string newdir = *j;
+ // remove trailing slashes
+ if(*j->rbegin() == '/')
+ {
+ newdir = j->substr(0, j->size()-1);
+ }
+ if(std::find(this->LinkDirectories.begin(),
+ this->LinkDirectories.end(), newdir)
+ == this->LinkDirectories.end())
+ {target.AddLinkDirectory(*j);
+ }
+ }
}
target.MergeLinkLibraries( *this, name, this->LinkLibraries );
}
@@ -2419,19 +2410,19 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
- for(std::vector<std::string>::iterator d = this->LinkDirectories.begin();
- d != this->LinkDirectories.end(); ++d)
+ if (const char* linkDirsProp = this->GetProperty("LINK_DIRECTORIES"))
{
- if(mightExpandVariablesCMP0019(d->c_str()))
+ if(mightExpandVariablesCMP0019(linkDirsProp))
{
- std::string orig = *d;
- this->ExpandVariablesInString(*d, true, true);
- if(pol == cmPolicies::WARN && *d != orig)
+ std::string d = linkDirsProp;
+ std::string orig = linkDirsProp;
+ this->ExpandVariablesInString(d, true, true);
+ if(pol == cmPolicies::WARN && d != orig)
{
- w << "Evaluated link directory\n"
+ w << "Evaluated link directories\n"
<< " " << orig << "\n"
<< "as\n"
- << " " << *d << "\n";
+ << " " << d << "\n";
}
}
}
@@ -4138,16 +4129,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
void cmMakefile::SetProperty(const std::string& prop, const char* value)
{
- if ( prop == "LINK_DIRECTORIES" )
- {
- std::vector<std::string> varArgsExpanded;
- if(value)
- {
- cmSystemTools::ExpandListArgument(value, varArgsExpanded);
- }
- this->SetLinkDirectories(varArgsExpanded);
- return;
- }
if (prop == "INCLUDE_DIRECTORIES")
{
this->IncludeDirectoriesEntries.clear();
@@ -4212,17 +4193,6 @@ void cmMakefile::AppendProperty(const std::string& prop,
cmValueWithOrigin(value, lfbt));
return;
}
- if ( prop == "LINK_DIRECTORIES" )
- {
- std::vector<std::string> varArgsExpanded;
- cmSystemTools::ExpandListArgument(value, varArgsExpanded);
- for(std::vector<std::string>::const_iterator vi = varArgsExpanded.begin();
- vi != varArgsExpanded.end(); ++vi)
- {
- this->AddLinkDirectory(*vi);
- }
- return;
- }
this->Properties.AppendProperty(prop, value, asString);
}
@@ -4278,11 +4248,6 @@ const char *cmMakefile::GetProperty(const std::string& prop,
this->GetListOfMacros(output);
return output.c_str();
}
- else if (prop == "LINK_DIRECTORIES")
- {
- output = cmJoin(this->GetLinkDirectories(), ";");
- return output.c_str();
- }
else if (prop == "INCLUDE_DIRECTORIES")
{
std::string sep;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a4a7dc2..e86aa3b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -229,20 +229,6 @@ public:
void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d);
/**
- * Add a link directory to the build.
- */
- void AddLinkDirectory(const std::string&);
-
- const std::vector<std::string>& GetLinkDirectories() const
- {
- return this->LinkDirectories;
- }
- void SetLinkDirectories(const std::vector<std::string>& vec)
- {
- this->LinkDirectories = vec;
- }
-
- /**
* Add a subdirectory to the build.
*/
void AddSubDirectory(const std::string& fullSrcDir,