From 06cfe37e220e0df6468ca65d2225d213cbb464c4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Jun 2004 12:56:25 -0400 Subject: [PATCH] BUG: Need to preserve automatic addition of source tree to -I path if CMAKE_BACKWARDS_COMPATIBILITY is set to below 2.0. --- Source/cmLocalUnixMakefileGenerator.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index f9b4c7ebb..5da812c03 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -2494,6 +2494,23 @@ void cmLocalUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout) std::vector& includes = m_Makefile->GetIncludeDirectories(); std::vector::iterator i; std::map implicitIncludes; + + // CMake versions below 2.0 would add the source tree to the -I path + // automatically. Preserve compatibility. + const char* versionValue = + this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); + if(versionValue) + { + int major = 0; + int minor = 0; + if(sscanf(versionValue, "%d.%d", &major, &minor) == 2 && major < 2) + { + fout << "-I" + << this->ConvertToOutputForExisting(m_Makefile->GetStartDirectory()) + << " "; + } + } + implicitIncludes["/usr/include"] = "/usr/include"; if(m_Makefile->GetDefinition("CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES")) {