summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio6Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-18 16:51:23 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-18 16:51:23 (GMT)
commit9ba02838701e2513414f258dec9d63566ee9b481 (patch)
tree5b268384b83211c28c03c46f68a2598396c3f4ba /Source/cmLocalVisualStudio6Generator.cxx
parentfc70e3512ad2785daad4629f62309d12f1a3a32b (diff)
downloadCMake-9ba02838701e2513414f258dec9d63566ee9b481.zip
CMake-9ba02838701e2513414f258dec9d63566ee9b481.tar.gz
CMake-9ba02838701e2513414f258dec9d63566ee9b481.tar.bz2
ENH: If CMAKE_NO_AUTOMATIC_INCLUDE_DIRECTORIES is not set try to approximate in-source build include file behavior in an out-of-source build by adding the build tree directory corresponding to a source tree directory at the beginning of the include path. Also fixed VS6 and VS7 generators to use cmLocalGenerator's computation of include paths. The VS6 generator will now short-path the include directories if the total length is too long in order to try to avoid its truncation limit.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx45
1 files changed, 33 insertions, 12 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 5601375..cff119c 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -55,24 +55,45 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
}
}
- // Setup /I and /LIBPATH options for the resulting DSP file
- std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
- std::vector<std::string>::iterator i;
- for(i = includes.begin(); i != includes.end(); ++i)
+ // 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 threatents this problem.
+ unsigned int maxIncludeLength = 3000;
+ bool useShortPath = false;
+ for(int j=0; j < 2; ++j)
{
- m_IncludeOptions += " /I ";
- std::string tmp = this->ConvertToOptionallyRelativeOutputPath(i->c_str());
+ 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);
+ }
+ m_IncludeOptions += " /I ";
- // quote if not already quoted
- if (tmp[0] != '"')
+ // quote if not already quoted
+ if (tmp[0] != '"')
+ {
+ m_IncludeOptions += "\"";
+ m_IncludeOptions += tmp;
+ m_IncludeOptions += "\"";
+ }
+ else
+ {
+ m_IncludeOptions += tmp;
+ }
+ }
+ if(j == 0 && m_IncludeOptions.size() > maxIncludeLength)
{
- m_IncludeOptions += "\"";
- m_IncludeOptions += tmp;
- m_IncludeOptions += "\"";
+ m_IncludeOptions = "";
+ useShortPath = true;
}
else
{
- m_IncludeOptions += tmp;
+ break;
}
}