ENH: make sure -F is not duplicated
This commit is contained in:
parent
82bb6fae0d
commit
552842d11f
|
@ -70,6 +70,8 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
cmSystemTools::GlobDirs(args[j].c_str(), path);
|
cmSystemTools::GlobDirs(args[j].c_str(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH");
|
||||||
|
|
||||||
// add the standard path
|
// add the standard path
|
||||||
cmSystemTools::GetPath(path);
|
cmSystemTools::GetPath(path);
|
||||||
for(unsigned int k=0; k < path.size(); k++)
|
for(unsigned int k=0; k < path.size(); k++)
|
||||||
|
@ -88,7 +90,7 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined (__APPLE__)
|
#if defined (__APPLE__)
|
||||||
cmStdString fpath = this->FindHeaderInFrameworks(args[0].c_str(), args[1].c_str());
|
cmStdString fpath = this->FindHeaderInFrameworks(path, args[0].c_str(), args[1].c_str());
|
||||||
if(fpath.size())
|
if(fpath.size())
|
||||||
{
|
{
|
||||||
m_Makefile->AddCacheDefinition(args[0].c_str(),
|
m_Makefile->AddCacheDefinition(args[0].c_str(),
|
||||||
|
@ -106,8 +108,10 @@ bool cmFindFileCommand::InitialPass(std::vector<std::string> const& argsIn)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmStdString cmFindFileCommand::FindHeaderInFrameworks(const char* defineVar,
|
cmStdString cmFindFileCommand::FindHeaderInFrameworks(
|
||||||
const char* file)
|
std::vector<std::string> path,
|
||||||
|
const char* defineVar,
|
||||||
|
const char* file)
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
return cmStdString("");
|
return cmStdString("");
|
||||||
|
@ -130,12 +134,11 @@ cmStdString cmFindFileCommand::FindHeaderInFrameworks(const char* defineVar,
|
||||||
frameWorkName = "";
|
frameWorkName = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<cmStdString> path;
|
|
||||||
path.push_back("~/Library/Frameworks");
|
path.push_back("~/Library/Frameworks");
|
||||||
path.push_back("/Library/Frameworks");
|
path.push_back("/Library/Frameworks");
|
||||||
path.push_back("/System/Library/Frameworks");
|
path.push_back("/System/Library/Frameworks");
|
||||||
path.push_back("/Network/Library/Frameworks");
|
path.push_back("/Network/Library/Frameworks");
|
||||||
for( std::vector<cmStdString>::iterator i = path.begin();
|
for( std::vector<std::string>::iterator i = path.begin();
|
||||||
i != path.end(); ++i)
|
i != path.end(); ++i)
|
||||||
{
|
{
|
||||||
if(frameWorkName.size())
|
if(frameWorkName.size())
|
||||||
|
|
|
@ -79,7 +79,8 @@ public:
|
||||||
"different extensions on different platforms, FIND_PROGRAM "
|
"different extensions on different platforms, FIND_PROGRAM "
|
||||||
"should be used instead of FIND_FILE when looking for them.";
|
"should be used instead of FIND_FILE when looking for them.";
|
||||||
}
|
}
|
||||||
cmStdString FindHeaderInFrameworks(const char* var, const char* file);
|
cmStdString FindHeaderInFrameworks( std::vector<std::string> path,
|
||||||
|
const char* var, const char* file);
|
||||||
cmTypeMacro(cmFindFileCommand, cmCommand);
|
cmTypeMacro(cmFindFileCommand, cmCommand);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -513,14 +513,34 @@ cmLocalUnixMakefileGenerator3
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
return std::string();
|
return std::string();
|
||||||
#else
|
#else
|
||||||
|
std::set<cmStdString> emitted;
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
this->GetIncludeDirectories(includes);
|
||||||
|
std::vector<std::string>::iterator i;
|
||||||
|
// check all include directories for frameworks as this
|
||||||
|
// will already have added a -F for the framework
|
||||||
|
for(i = includes.begin(); i != includes.end(); ++i)
|
||||||
|
{
|
||||||
|
if(cmSystemTools::IsPathToFramework(i->c_str()))
|
||||||
|
{
|
||||||
|
std::string frameworkDir = *i;
|
||||||
|
frameworkDir += "/../";
|
||||||
|
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str());
|
||||||
|
emitted.insert(frameworkDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string flags;
|
std::string flags;
|
||||||
std::vector<std::string>& frameworks = target.GetFrameworks();
|
std::vector<std::string>& frameworks = target.GetFrameworks();
|
||||||
for(std::vector<std::string>::iterator i = frameworks.begin();
|
for(i = frameworks.begin();
|
||||||
i != frameworks.end(); ++i)
|
i != frameworks.end(); ++i)
|
||||||
{
|
{
|
||||||
flags += "-F";
|
if(emitted.insert(*i).second)
|
||||||
flags += this->ConvertToOutputForExisting(i->c_str());
|
{
|
||||||
flags += " ";
|
flags += "-F";
|
||||||
|
flags += this->ConvertToOutputForExisting(i->c_str());
|
||||||
|
flags += " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return flags;
|
return flags;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue