summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-19 18:10:25 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-19 18:10:25 (GMT)
commit98a187a8d49feecc05c8eb43caeb16a7230d75a3 (patch)
treeb38f21c407220de6a671921cfef9517a8292369c /Source/cmLocalGenerator.cxx
parentb6fd3b7bb1ef208dd2b65a00fe9fe595b414cae5 (diff)
downloadCMake-98a187a8d49feecc05c8eb43caeb16a7230d75a3.zip
CMake-98a187a8d49feecc05c8eb43caeb16a7230d75a3.tar.gz
CMake-98a187a8d49feecc05c8eb43caeb16a7230d75a3.tar.bz2
ENH: Automatic include directories should not be done by default as was just implemented. Instead a project may now set CMAKE_INCLUDE_CURRENT_DIR to get this behavior. The current source and binary directories are added automatically to the beginning of the include path in every directory. This simulates in-source behavior for double-quote includes when there are generated sources and headers in the directory.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx49
1 files changed, 24 insertions, 25 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a72faf9..d7cbd5b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1141,9 +1141,29 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
{
+ // Need to decide whether to automatically include the source and
+ // binary directories at the beginning of the include path.
+ bool includeSourceDir = false;
+ bool includeBinaryDir = false;
+
+ // When automatic include directories are requested for an
+ // out-of-source build then include the source and binary
+ // directories at the beginning of the include path to approximate
+ // include file behavior for an in-source build. This does not
+ // account for the case of a source file in a subdirectory of the
+ // current source directory but we cannot fix this because not all
+ // native build tools support per-source-file include paths.
+ bool inSource =
+ cmSystemTools::ComparePath(m_Makefile->GetStartDirectory(),
+ m_Makefile->GetStartOutputDirectory());
+ if(!inSource && m_Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR"))
+ {
+ includeSourceDir = true;
+ includeBinaryDir = true;
+ }
+
// CMake versions below 2.0 would add the source tree to the -I path
// automatically. Preserve compatibility.
- bool includeSourceDir = false;
const char* versionValue =
m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
int major = 0;
@@ -1156,11 +1176,13 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
{
includeSourceDir = true;
}
+
+ // Hack for VTK 4.0 - 4.4 which depend on the old behavior but do
+ // not set the backwards compatibility level automatically.
const char* vtkSourceDir =
m_Makefile->GetDefinition("VTK_SOURCE_DIR");
if(vtkSourceDir)
{
- // Special hack for VTK 4.0 - 4.4.
const char* vtk_major = m_Makefile->GetDefinition("VTK_MAJOR_VERSION");
const char* vtk_minor = m_Makefile->GetDefinition("VTK_MINOR_VERSION");
vtk_major = vtk_major? vtk_major : "4";
@@ -1174,29 +1196,6 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs)
}
}
- // If this is not an in-source build then include the binary
- // directory at the beginning of the include path to approximate
- // include file behavior for an in-source build. This does not
- // account for the case of a source file in a subdirectory of the
- // current source directory but we cannot fix this because not all
- // native build tools support per-source-file include paths. Allow
- // the behavior to be disabled by the project.
- bool includeBinaryDir =
- !cmSystemTools::ComparePath(m_Makefile->GetStartDirectory(),
- m_Makefile->GetStartOutputDirectory());
- if(m_Makefile->IsOn("CMAKE_NO_AUTOMATIC_INCLUDE_DIRECTORIES"))
- {
- includeSourceDir = false;
- includeBinaryDir = false;
- }
-
- // CMake versions 2.2 and earlier did not add the binary directory
- // automatically.
- if(versionValue && ((major < 2) || major == 2 && minor < 3))
- {
- includeBinaryDir = false;
- }
-
// Do not repeat an include path.
std::set<cmStdString> emitted;