ENH: fix IntDir jump and build problem

This commit is contained in:
Bill Hoffman 2002-12-06 15:35:22 -05:00
parent 7987ce88cb
commit b0f4a4cb39
5 changed files with 44 additions and 32 deletions

View File

@ -28,6 +28,7 @@ cmGlobalUnixMakefileGenerator::cmGlobalUnixMakefileGenerator()
void cmGlobalUnixMakefileGenerator::EnableLanguage(const char* lang,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_CFG_INTDIR",".");
this->cmGlobalGenerator::EnableLanguage(lang, mf);
}

View File

@ -27,6 +27,7 @@ cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
void cmGlobalVisualStudio6Generator::EnableLanguage(const char* lang,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
this->cmGlobalGenerator::EnableLanguage(lang, mf);

View File

@ -30,6 +30,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator()
void cmGlobalVisualStudio7Generator::EnableLanguage(const char* lang,
cmMakefile *mf)
{
mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
this->cmGlobalGenerator::EnableLanguage(lang, mf);

View File

@ -1096,6 +1096,7 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
// for each target
const cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
{
@ -1103,6 +1104,7 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
std::set<std::string> emitted;
if ((l->second.GetType() == cmTarget::SHARED_LIBRARY)
|| (l->second.GetType() == cmTarget::MODULE_LIBRARY)
|| (l->second.GetType() == cmTarget::STATIC_LIBRARY)
|| (l->second.GetType() == cmTarget::EXECUTABLE)
|| (l->second.GetType() == cmTarget::WIN32_EXECUTABLE))
{
@ -1110,7 +1112,9 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
// A library should not depend on itself!
emitted.insert(l->first);
// for static libraries do not depend on other libraries
if(l->second.GetType() != cmTarget::STATIC_LIBRARY)
{
// Now, look at all link libraries specific to this target.
const cmTarget::LinkLibraries& tlibs = l->second.GetLinkLibraries();
for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
@ -1126,7 +1130,8 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
this->OutputLibDepend(fout, lib->first.c_str());
}
}
}
// for all targets depend on utilities
// Now, look at all utilities specific to this target.
const std::set<cmStdString>& tutils = l->second.GetUtilities();
for(std::set<cmStdString>::const_iterator util = tutils.begin();
@ -1142,7 +1147,6 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
this->OutputExeDepend(fout, util->c_str());
}
}
fout << "\n";
}
}
@ -1161,6 +1165,7 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
// be stored in the cache
std::string libPath = *lib + "_CMAKE_PATH";
const char* cacheValue = m_Makefile->GetDefinition(libPath.c_str());
// if cache and not the current directory add a rule, to
// jump into the directory and build for the first time
if(cacheValue &&
@ -1228,10 +1233,12 @@ void cmLocalUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
{
exepath += "/";
}
exepath += *lib;
std::string fullName = lib->c_str();
fullName += cmSystemTools::GetExecutableExtension();
exepath += fullName;
this->OutputBuildTargetInDir(fout,
cacheValue,
lib->c_str(),
fullName.c_str(),
exepath.c_str(),
m_Makefile->
GetDefinition("EXECUTABLE_OUTPUT_PATH")
@ -1761,8 +1768,9 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
{
// escape spaces and convert to native slashes path for
// the command
std::string command =
cmSystemTools::ConvertToOutputPath(c->second.m_Command.c_str());
std::string command = c->second.m_Command;
cmSystemTools::ReplaceString(command, "/./", "/");
command = cmSystemTools::ConvertToOutputPath(command.c_str());
command += " ";
// now add the arguments
command += c->second.m_Arguments;
@ -1777,7 +1785,10 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
commandFiles.m_Depends.begin();
d != commandFiles.m_Depends.end(); ++d)
{
std::string dep = cmSystemTools::ConvertToOutputPath(d->c_str());
std::string dep = *d;
cmSystemTools::ReplaceString(dep, "/./", "/");
cmSystemTools::ReplaceString(dep, "/$(IntDir)/", "/");
dep = cmSystemTools::ConvertToOutputPath(dep.c_str());
depends += " ";
depends += dep;
}
@ -1801,7 +1812,10 @@ void cmLocalUnixMakefileGenerator::OutputCustomRules(std::ostream& fout)
commandFiles.m_Depends.begin();
d != commandFiles.m_Depends.end(); ++d)
{
std::string dep = cmSystemTools::ConvertToOutputPath(d->c_str());
std::string dep = *d;
cmSystemTools::ReplaceString(dep, "/./", "/");
cmSystemTools::ReplaceString(dep, "/$(IntDir)/", "/");
dep = cmSystemTools::ConvertToOutputPath(dep.c_str());
depends += " ";
depends += dep;
}

View File

@ -1118,11 +1118,6 @@ void cmMakefile::AddDefaultDefinitions()
this->AddDefinition("APPLE", "1");
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
this->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)");
#else
this->AddDefinition("CMAKE_CFG_INTDIR",".");
#endif
char temp[1024];
sprintf(temp, "%d", cmMakefile::GetMinorVersion());
this->AddDefinition("CMAKE_MINOR_VERSION", temp);