Refactor GetIncludeFlags to take includes instead of fetching them
This commit is contained in:
parent
6a1c5a3569
commit
edd5303949
|
@ -574,7 +574,11 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
||||||
std::string flags;
|
std::string flags;
|
||||||
flags += this->Makefile->GetSafeDefinition(varString.c_str());
|
flags += this->Makefile->GetSafeDefinition(varString.c_str());
|
||||||
flags += " ";
|
flags += " ";
|
||||||
flags += this->GetIncludeFlags(lang);
|
{
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
this->GetIncludeDirectories(includes, lang);
|
||||||
|
flags += this->GetIncludeFlags(includes, lang);
|
||||||
|
}
|
||||||
flags += this->Makefile->GetDefineFlags();
|
flags += this->Makefile->GetDefineFlags();
|
||||||
|
|
||||||
// Construct the command lines.
|
// Construct the command lines.
|
||||||
|
@ -1192,8 +1196,9 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
|
const char* cmLocalGenerator::GetIncludeFlags(
|
||||||
bool forResponseFile)
|
const std::vector<std::string> &includes,
|
||||||
|
const char* lang, bool forResponseFile)
|
||||||
{
|
{
|
||||||
if(!lang)
|
if(!lang)
|
||||||
{
|
{
|
||||||
|
@ -1207,9 +1212,6 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmOStringStream includeFlags;
|
cmOStringStream includeFlags;
|
||||||
std::vector<std::string> includes;
|
|
||||||
this->GetIncludeDirectories(includes, lang);
|
|
||||||
std::vector<std::string>::iterator i;
|
|
||||||
|
|
||||||
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
|
std::string flagVar = "CMAKE_INCLUDE_FLAG_";
|
||||||
flagVar += lang;
|
flagVar += lang;
|
||||||
|
@ -1251,6 +1253,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
emitted.insert("/System/Library/Frameworks");
|
emitted.insert("/System/Library/Frameworks");
|
||||||
#endif
|
#endif
|
||||||
|
std::vector<std::string>::const_iterator i;
|
||||||
for(i = includes.begin(); i != includes.end(); ++i)
|
for(i = includes.begin(); i != includes.end(); ++i)
|
||||||
{
|
{
|
||||||
if(this->Makefile->IsOn("APPLE")
|
if(this->Makefile->IsOn("APPLE")
|
||||||
|
|
|
@ -146,8 +146,8 @@ public:
|
||||||
///! Append flags to a string.
|
///! Append flags to a string.
|
||||||
virtual void AppendFlags(std::string& flags, const char* newFlags);
|
virtual void AppendFlags(std::string& flags, const char* newFlags);
|
||||||
///! Get the include flags for the current makefile and language
|
///! Get the include flags for the current makefile and language
|
||||||
const char* GetIncludeFlags(const char* lang,
|
const char* GetIncludeFlags(const std::vector<std::string> &includes,
|
||||||
bool forResponseFile = false);
|
const char* lang, bool forResponseFile = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a list of preprocessor definitions for the compiler
|
* Encode a list of preprocessor definitions for the compiler
|
||||||
|
|
|
@ -1829,8 +1829,12 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||||
responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES";
|
responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES";
|
||||||
bool useResponseFile = this->Makefile->IsOn(responseVar.c_str());
|
bool useResponseFile = this->Makefile->IsOn(responseVar.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
this->LocalGenerator->GetIncludeDirectories(includes, lang);
|
||||||
|
|
||||||
std::string includeFlags =
|
std::string includeFlags =
|
||||||
this->LocalGenerator->GetIncludeFlags(lang, useResponseFile);
|
this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
|
||||||
if(includeFlags.empty())
|
if(includeFlags.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -605,7 +605,11 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||||
mf->AddIncludeDirectory(dirIt->c_str(), false);
|
mf->AddIncludeDirectory(dirIt->c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string includeFlags = lg->GetIncludeFlags(language.c_str(), false);
|
std::vector<std::string> includeDirectories;
|
||||||
|
lg->GetIncludeDirectories(includeDirectories, language.c_str());
|
||||||
|
std::string includeFlags = lg->GetIncludeFlags(includeDirectories,
|
||||||
|
language.c_str(), false);
|
||||||
|
|
||||||
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
|
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
|
||||||
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
|
printf("%s %s\n", includeFlags.c_str(), definitions.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue