Extract and use the INCLUDE_DIRECTORIES target properties.
Eliminate callers of cmMakefile::GetIncludeDirectories. All callers of GetIncludeDirectories should go through the local generator object. Only the local generator calls cmTarget::GetIncludeDirectories directly.
This commit is contained in:
parent
840509babb
commit
9106b564ae
|
@ -260,12 +260,24 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmDepends::SetIncludePathFromLanguage(const char* lang)
|
void cmDepends::SetIncludePathFromLanguage(const char* lang)
|
||||||
{
|
{
|
||||||
|
// Look for the new per "TARGET_" variant first:
|
||||||
std::string includePathVar = "CMAKE_";
|
std::string includePathVar = "CMAKE_";
|
||||||
includePathVar += lang;
|
includePathVar += lang;
|
||||||
includePathVar += "_INCLUDE_PATH";
|
includePathVar += "_TARGET_INCLUDE_PATH";
|
||||||
cmMakefile* mf = this->LocalGenerator->GetMakefile();
|
cmMakefile* mf = this->LocalGenerator->GetMakefile();
|
||||||
if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
|
if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
|
||||||
{
|
{
|
||||||
cmSystemTools::ExpandListArgument(includePath, this->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";
|
||||||
|
if(const char* includePath = mf->GetDefinition(includePathVar.c_str()))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -600,16 +600,17 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
|
|
||||||
// the include directories for this target
|
// the include directories for this target
|
||||||
std::set<std::string> uniqIncludeDirs;
|
std::set<std::string> uniqIncludeDirs;
|
||||||
const std::vector<std::string>& incDirs =
|
|
||||||
target->GetMakefile()->GetIncludeDirectories();
|
std::vector<std::string> includes;
|
||||||
for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
|
target->GetMakefile()->GetLocalGenerator()->
|
||||||
dirIt != incDirs.end();
|
GetIncludeDirectories(includes, target);
|
||||||
|
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
|
||||||
|
dirIt != includes.end();
|
||||||
++dirIt)
|
++dirIt)
|
||||||
{
|
{
|
||||||
uniqIncludeDirs.insert(*dirIt);
|
uniqIncludeDirs.insert(*dirIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string systemIncludeDirs = makefile->GetSafeDefinition(
|
std::string systemIncludeDirs = makefile->GetSafeDefinition(
|
||||||
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
|
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
|
||||||
if (!systemIncludeDirs.empty())
|
if (!systemIncludeDirs.empty())
|
||||||
|
|
|
@ -893,10 +893,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
||||||
it != this->GlobalGenerator->GetLocalGenerators().end();
|
it != this->GlobalGenerator->GetLocalGenerators().end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
const std::vector<std::string>& includeDirs
|
cmTargets & targets = (*it)->GetMakefile()->GetTargets();
|
||||||
= (*it)->GetMakefile()->GetIncludeDirectories();
|
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);
|
this->AppendIncludeDirectories(fout, includeDirs, emmited);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// now also the system include directories, in case we found them in
|
// now also the system include directories, in case we found them in
|
||||||
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
|
// CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
|
||||||
// standard headers.
|
// standard headers.
|
||||||
|
|
|
@ -1067,9 +1067,9 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
{
|
{
|
||||||
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
|
manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager();
|
||||||
this->LocalGenerators[i]->ConfigureFinalPass();
|
this->LocalGenerators[i]->ConfigureFinalPass();
|
||||||
const cmTargets & targets =
|
cmTargets & targets =
|
||||||
this->LocalGenerators[i]->GetMakefile()->GetTargets();
|
this->LocalGenerators[i]->GetMakefile()->GetTargets();
|
||||||
for (cmTargets::const_iterator l = targets.begin();
|
for (cmTargets::iterator l = targets.begin();
|
||||||
l != targets.end(); l++)
|
l != targets.end(); l++)
|
||||||
{
|
{
|
||||||
const cmTarget::LinkLibraryVectorType& libs =
|
const cmTarget::LinkLibraryVectorType& libs =
|
||||||
|
@ -1095,9 +1095,8 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
notFoundMap[varName] = text;
|
notFoundMap[varName] = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
std::vector<std::string> incs;
|
||||||
const std::vector<std::string>& incs =
|
this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second);
|
||||||
this->LocalGenerators[i]->GetMakefile()->GetIncludeDirectories();
|
|
||||||
|
|
||||||
for( std::vector<std::string>::const_iterator incDir = incs.begin();
|
for( std::vector<std::string>::const_iterator incDir = incs.begin();
|
||||||
incDir != incs.end(); ++incDir)
|
incDir != incs.end(); ++incDir)
|
||||||
|
@ -1114,10 +1113,12 @@ void cmGlobalGenerator::CheckLocalGenerators()
|
||||||
}
|
}
|
||||||
std::string text = notFoundMap[varName];
|
std::string text = notFoundMap[varName];
|
||||||
text += "\n used as include directory in directory ";
|
text += "\n used as include directory in directory ";
|
||||||
text += this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
|
text += this->LocalGenerators[i]
|
||||||
|
->GetMakefile()->GetCurrentDirectory();
|
||||||
notFoundMap[varName] = text;
|
notFoundMap[varName] = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->CMakeInstance->UpdateProgress
|
this->CMakeInstance->UpdateProgress
|
||||||
("Configuring", 0.9f+0.1f*(static_cast<float>(i)+1.0f)/
|
("Configuring", 0.9f+0.1f*(static_cast<float>(i)+1.0f)/
|
||||||
static_cast<float>(this->LocalGenerators.size()));
|
static_cast<float>(this->LocalGenerators.size()));
|
||||||
|
|
|
@ -1811,7 +1811,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
||||||
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
|
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
|
||||||
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
|
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->CurrentLocalGenerator->GetIncludeDirectories(includes);
|
this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target);
|
||||||
std::set<cmStdString> emitted;
|
std::set<cmStdString> emitted;
|
||||||
emitted.insert("/System/Library/Frameworks");
|
emitted.insert("/System/Library/Frameworks");
|
||||||
for(std::vector<std::string>::iterator i = includes.begin();
|
for(std::vector<std::string>::iterator i = includes.begin();
|
||||||
|
|
|
@ -556,7 +556,7 @@ void cmLocalGenerator::GenerateTargetManifest()
|
||||||
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
||||||
const char* lang,
|
const char* lang,
|
||||||
cmSourceFile& source,
|
cmSourceFile& source,
|
||||||
cmTarget& )
|
cmTarget& target)
|
||||||
{
|
{
|
||||||
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
|
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
|
||||||
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
|
objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL);
|
||||||
|
@ -576,7 +576,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
||||||
flags += " ";
|
flags += " ";
|
||||||
{
|
{
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->GetIncludeDirectories(includes, lang);
|
this->GetIncludeDirectories(includes, &target, lang);
|
||||||
flags += this->GetIncludeFlags(includes, lang);
|
flags += this->GetIncludeFlags(includes, lang);
|
||||||
}
|
}
|
||||||
flags += this->Makefile->GetDefineFlags();
|
flags += this->Makefile->GetDefineFlags();
|
||||||
|
@ -1313,6 +1313,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
|
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
|
||||||
|
cmTarget* target,
|
||||||
const char* lang)
|
const char* lang)
|
||||||
{
|
{
|
||||||
// Need to decide whether to automatically include the source and
|
// Need to decide whether to automatically include the source and
|
||||||
|
@ -1398,9 +1399,12 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the project-specified include directories.
|
// Get the target-specific include directories.
|
||||||
const std::vector<std::string>& includes =
|
std::vector<std::string> includes;
|
||||||
this->Makefile->GetIncludeDirectories();
|
if(target)
|
||||||
|
{
|
||||||
|
includes = target->GetIncludeDirectories();
|
||||||
|
}
|
||||||
|
|
||||||
// Support putting all the in-project include directories first if
|
// Support putting all the in-project include directories first if
|
||||||
// it is requested by the project.
|
// it is requested by the project.
|
||||||
|
|
|
@ -195,6 +195,7 @@ public:
|
||||||
|
|
||||||
/** Get the include flags for the current makefile and language. */
|
/** Get the include flags for the current makefile and language. */
|
||||||
void GetIncludeDirectories(std::vector<std::string>& dirs,
|
void GetIncludeDirectories(std::vector<std::string>& dirs,
|
||||||
|
cmTarget* target,
|
||||||
const char* lang = "C");
|
const char* lang = "C");
|
||||||
|
|
||||||
/** Compute the language used to compile the given source file. */
|
/** Compute the language used to compile the given source file. */
|
||||||
|
|
|
@ -452,28 +452,6 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
|
||||||
<< "\n";
|
<< "\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.
|
// Store the include regular expressions for this directory.
|
||||||
infoFileStream
|
infoFileStream
|
||||||
<< "\n"
|
<< "\n"
|
||||||
|
|
|
@ -103,49 +103,6 @@ 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
|
// Create the DSP or set of DSP's for libraries and executables
|
||||||
|
|
||||||
cmTargets &tgts = this->Makefile->GetTargets();
|
cmTargets &tgts = this->Makefile->GetTargets();
|
||||||
|
@ -895,6 +852,61 @@ inline std::string removeQuotes(const std::string& s)
|
||||||
return 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
|
// Code in blocks surrounded by a test for this definition is needed
|
||||||
// only for compatibility with user project's replacement DSP
|
// only for compatibility with user project's replacement DSP
|
||||||
// templates. The CMake templates no longer use them.
|
// templates. The CMake templates no longer use them.
|
||||||
|
@ -1132,6 +1144,9 @@ void cmLocalVisualStudio6Generator
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Get include options for this target.
|
||||||
|
std::string includeOptions = this->GetTargetIncludeOptions(target);
|
||||||
|
|
||||||
// Get extra linker options for this target type.
|
// Get extra linker options for this target type.
|
||||||
std::string extraLinkOptions;
|
std::string extraLinkOptions;
|
||||||
std::string extraLinkOptionsDebug;
|
std::string extraLinkOptionsDebug;
|
||||||
|
@ -1510,7 +1525,7 @@ void cmLocalVisualStudio6Generator
|
||||||
optionsRelWithDebInfo.c_str());
|
optionsRelWithDebInfo.c_str());
|
||||||
|
|
||||||
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
|
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
|
||||||
this->IncludeOptions.c_str());
|
includeOptions.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG",
|
cmSystemTools::ReplaceString(line, "TARGET_VERSION_FLAG",
|
||||||
targetVersionFlag.c_str());
|
targetVersionFlag.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG",
|
cmSystemTools::ReplaceString(line, "TARGET_IMPLIB_FLAG_DEBUG",
|
||||||
|
|
|
@ -89,7 +89,7 @@ private:
|
||||||
void ComputeLinkOptions(cmTarget& target, const char* configName,
|
void ComputeLinkOptions(cmTarget& target, const char* configName,
|
||||||
const std::string extraOptions,
|
const std::string extraOptions,
|
||||||
std::string& options);
|
std::string& options);
|
||||||
std::string IncludeOptions;
|
std::string GetTargetIncludeOptions(cmTarget &target);
|
||||||
std::vector<std::string> Configurations;
|
std::vector<std::string> Configurations;
|
||||||
|
|
||||||
std::string GetConfigName(std::string const& configuration) const;
|
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");
|
targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
|
||||||
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
|
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->GetIncludeDirectories(includes);
|
this->GetIncludeDirectories(includes, &target);
|
||||||
std::vector<std::string>::iterator i = includes.begin();
|
std::vector<std::string>::iterator i = includes.begin();
|
||||||
for(;i != includes.end(); ++i)
|
for(;i != includes.end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,9 +55,12 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
||||||
this->ComplainFileRegularExpression.compile(
|
this->ComplainFileRegularExpression.compile(
|
||||||
this->Makefile->ComplainFileRegularExpression.c_str());
|
this->Makefile->ComplainFileRegularExpression.c_str());
|
||||||
|
|
||||||
// Now extract any include paths from the makefile flags
|
// Now extract any include paths from the targets
|
||||||
|
cmTargets & targets = this->Makefile->GetTargets();
|
||||||
|
for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l)
|
||||||
|
{
|
||||||
const std::vector<std::string>& includes =
|
const std::vector<std::string>& includes =
|
||||||
this->Makefile->GetIncludeDirectories();
|
l->second.GetIncludeDirectories();
|
||||||
for(std::vector<std::string>::const_iterator j = includes.begin();
|
for(std::vector<std::string>::const_iterator j = includes.begin();
|
||||||
j != includes.end(); ++j)
|
j != includes.end(); ++j)
|
||||||
{
|
{
|
||||||
|
@ -66,6 +69,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile)
|
||||||
this->AddSearchPath(path.c_str());
|
this->AddSearchPath(path.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const cmDependInformation* cmMakeDepend::FindDependencies(const char* file)
|
const cmDependInformation* cmMakeDepend::FindDependencies(const char* file)
|
||||||
|
|
|
@ -1069,6 +1069,35 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
|
||||||
<< "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
|
<< "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Target-specific include directories:
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< "\n"
|
||||||
|
<< "# The include file search paths:\n";
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< "SET(CMAKE_C_TARGET_INCLUDE_PATH\n";
|
||||||
|
std::vector<std::string> includes;
|
||||||
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
|
||||||
|
for(std::vector<std::string>::iterator i = includes.begin();
|
||||||
|
i != includes.end(); ++i)
|
||||||
|
{
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< " \""
|
||||||
|
<< this->LocalGenerator->Convert(i->c_str(),
|
||||||
|
cmLocalGenerator::HOME_OUTPUT)
|
||||||
|
<< "\"\n";
|
||||||
|
}
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< " )\n";
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< "SET(CMAKE_CXX_TARGET_INCLUDE_PATH "
|
||||||
|
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH "
|
||||||
|
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
|
||||||
|
*this->InfoFileStream
|
||||||
|
<< "SET(CMAKE_ASM_TARGET_INCLUDE_PATH "
|
||||||
|
<< "${CMAKE_C_TARGET_INCLUDE_PATH})\n";
|
||||||
|
|
||||||
// and now write the rule to use it
|
// and now write the rule to use it
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
|
@ -1534,7 +1563,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags()
|
||||||
emitted.insert("/System/Library/Frameworks");
|
emitted.insert("/System/Library/Frameworks");
|
||||||
#endif
|
#endif
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes);
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
|
||||||
std::vector<std::string>::iterator i;
|
std::vector<std::string>::iterator i;
|
||||||
// check all include directories for frameworks as this
|
// check all include directories for frameworks as this
|
||||||
// will already have added a -F for the framework
|
// will already have added a -F for the framework
|
||||||
|
@ -1831,7 +1860,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes, lang);
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang);
|
||||||
|
|
||||||
std::string includeFlags =
|
std::string includeFlags =
|
||||||
this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
|
this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile);
|
||||||
|
@ -1934,7 +1963,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
|
||||||
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
|
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
|
||||||
{
|
{
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes);
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
|
||||||
for(std::vector<std::string>::const_iterator idi = includes.begin();
|
for(std::vector<std::string>::const_iterator idi = includes.begin();
|
||||||
idi != includes.end(); ++idi)
|
idi != includes.end(); ++idi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1586,7 +1586,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
|
||||||
static_cast<cmGlobalVisualStudio7Generator *>
|
static_cast<cmGlobalVisualStudio7Generator *>
|
||||||
(this->GlobalGenerator)->GetConfigurations();
|
(this->GlobalGenerator)->GetConfigurations();
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes);
|
this->LocalGenerator->GetIncludeDirectories(includes, this->Target);
|
||||||
for(std::vector<std::string>::iterator i = configs->begin();
|
for(std::vector<std::string>::iterator i = configs->begin();
|
||||||
i != configs->end(); ++i)
|
i != configs->end(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -598,16 +598,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
|
||||||
std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
|
std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
|
||||||
std::vector<std::string> includeDirs;
|
std::vector<std::string> includeDirs;
|
||||||
cmSystemTools::ExpandListArgument(includes, includeDirs);
|
cmSystemTools::ExpandListArgument(includes, includeDirs);
|
||||||
for(std::vector<std::string>::const_iterator dirIt=includeDirs.begin();
|
|
||||||
dirIt != includeDirs.end();
|
|
||||||
++dirIt)
|
|
||||||
{
|
|
||||||
mf->AddIncludeDirectory(dirIt->c_str(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> includeDirectories;
|
std::string includeFlags = lg->GetIncludeFlags(includeDirs,
|
||||||
lg->GetIncludeDirectories(includeDirectories, language.c_str());
|
|
||||||
std::string includeFlags = lg->GetIncludeFlags(includeDirectories,
|
|
||||||
language.c_str(), false);
|
language.c_str(), false);
|
||||||
|
|
||||||
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
|
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
|
||||||
|
|
|
@ -45,3 +45,5 @@ else()
|
||||||
set_target_properties(IncludeDirectories
|
set_target_properties(IncludeDirectories
|
||||||
PROPERTIES COMPILE_FLAGS "-ITarProp")
|
PROPERTIES COMPILE_FLAGS "-ITarProp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(TargetIncludeDirectories)
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
project(TargetIncludeDirectories)
|
||||||
|
|
||||||
|
macro(create_header _name)
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_name}")
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_name}/${_name}.h"
|
||||||
|
"//${_name}.h
|
||||||
|
")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
create_header(bar)
|
||||||
|
create_header(bat)
|
||||||
|
create_header(foo)
|
||||||
|
create_header(baz)
|
||||||
|
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/bar")
|
||||||
|
|
||||||
|
add_executable(TargetIncludeDirectories main.cpp)
|
||||||
|
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/bat")
|
||||||
|
set_property(TARGET TargetIncludeDirectories APPEND PROPERTY INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo")
|
||||||
|
|
||||||
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/baz")
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
#include "bar.h"
|
||||||
|
#include "bat.h"
|
||||||
|
#include "foo.h"
|
||||||
|
#include "baz.h"
|
||||||
|
|
||||||
|
int main(int, char**)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue