BUG: fix jump to directory and build for nmake if library path is not set. combine OutputBuildExecutableInDir and OutputBuildLibraryInDir into OutputBuildTargetInDir

This commit is contained in:
Bill Hoffman 2002-07-31 13:45:07 -04:00
parent 836a280a6a
commit fc7e4169e1
4 changed files with 43 additions and 51 deletions

View File

@ -676,22 +676,27 @@ bool cmNMakeMakefileGenerator::SamePath(const char* path1, const char* path2)
cmSystemTools::LowerCase(ShortPath(path2)); cmSystemTools::LowerCase(ShortPath(path2));
} }
void cmNMakeMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout, void cmNMakeMakefileGenerator::OutputBuildTargetInDir(std::ostream& fout,
const char* path, const char* path,
const char* , const char* library,
const char* fullpath) const char* fullpath,
const char* libOutPath)
{ {
const char* makeTarget = library;
std::string currentDir = std::string currentDir =
this->ConvertToOutputPath(m_Makefile->GetCurrentOutputDirectory()); this->ConvertToOutputPath(m_Makefile->GetCurrentOutputDirectory());
std::string wpath = this->ConvertToOutputPath(path); std::string wpath = this->ConvertToOutputPath(path);
std::string wfullpath = this->ConvertToOutputPath(fullpath); std::string wfullpath = this->ConvertToOutputPath(fullpath);
if(libOutPath && strcmp( libOutPath, "" ) != 0)
{
makeTarget = wfullpath.c_str();
}
fout << wfullpath fout << wfullpath
<< ":\n\tcd " << wpath << "\n" << ":\n\tcd " << wpath << "\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.depends\n" << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.depends\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.check_depends\n" << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.check_depends\n"
<< "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) -f cmake.check_depends\n" << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) -f cmake.check_depends\n"
<< "\t$(MAKE) $(MAKESILENT) " << wfullpath << "\t$(MAKE) $(MAKESILENT) " << makeTarget
<< "\n\tcd " << currentDir << "\n"; << "\n\tcd " << currentDir << "\n";
} }

View File

@ -79,10 +79,11 @@ protected:
const cmTarget &tgt); const cmTarget &tgt);
virtual std::string GetOutputExtension(const char* sourceExtension); virtual std::string GetOutputExtension(const char* sourceExtension);
virtual void OutputIncludeMakefile(std::ostream&, const char* file); virtual void OutputIncludeMakefile(std::ostream&, const char* file);
virtual void OutputBuildLibraryInDir(std::ostream& fout, virtual void OutputBuildTargetInDir(std::ostream& fout,
const char* path, const char* path,
const char* library, const char* library,
const char* fullpath); const char* fullpath,
const char* outputPath);
///! return true if the two paths are the same (checks short paths) ///! return true if the two paths are the same (checks short paths)
virtual bool SamePath(const char* path1, const char* path2); virtual bool SamePath(const char* path1, const char* path2);
void SetLibraryPathOption(const char* lib){ m_LibraryPathOption = lib;} void SetLibraryPathOption(const char* lib){ m_LibraryPathOption = lib;}

View File

@ -986,10 +986,13 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
} }
libpath += library; libpath += library;
// put out a rule to build the library if it does not exist // put out a rule to build the library if it does not exist
this->OutputBuildLibraryInDir(fout, this->OutputBuildTargetInDir(fout,
cacheValue, cacheValue,
library.c_str(), library.c_str(),
libpath.c_str()); libpath.c_str(),
m_Makefile->
GetDefinition("LIBRARY_OUTPUT_PATH")
);
} }
// something other than a library... // something other than a library...
else else
@ -1004,23 +1007,26 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
exepath += "/"; exepath += "/";
} }
exepath += *lib; exepath += *lib;
this->OutputBuildExecutableInDir(fout, this->OutputBuildTargetInDir(fout,
cacheValue, cacheValue,
lib->c_str(), lib->c_str(),
exepath.c_str()); exepath.c_str(),
m_Makefile->
GetDefinition("EXECUTABLE_OUTPUT_PATH")
);
} }
} }
} }
} }
void cmUnixMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout, void cmUnixMakefileGenerator::OutputBuildTargetInDir(std::ostream& fout,
const char* path, const char* path,
const char* library, const char* library,
const char* fullpath) const char* fullpath,
const char* outputPath)
{ {
const char* makeTarget = library; const char* makeTarget = library;
const char* libOutPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"); if(outputPath && strcmp( outputPath, "" ) != 0)
if(libOutPath && strcmp( libOutPath, "" ) != 0)
{ {
makeTarget = fullpath; makeTarget = fullpath;
} }
@ -1029,27 +1035,10 @@ void cmUnixMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
<< "; $(MAKE) $(MAKESILENT) cmake.depends" << "; $(MAKE) $(MAKESILENT) cmake.depends"
<< "; $(MAKE) $(MAKESILENT) cmake.check_depends" << "; $(MAKE) $(MAKESILENT) cmake.check_depends"
<< "; $(MAKE) $(MAKESILENT) -f cmake.check_depends" << "; $(MAKE) $(MAKESILENT) -f cmake.check_depends"
<< "; $(MAKE) $(MAKESILENT) " << makeTarget << "\n\n"; << "; $(MAKE) $(MAKESILENT) "
<< this->ConvertToOutputPath(makeTarget) << "\n\n";
} }
void cmUnixMakefileGenerator::OutputBuildExecutableInDir(std::ostream& fout,
const char* path,
const char* library,
const char* fullpath)
{
const char* makeTarget = library;
const char* libOutPath = m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
if(libOutPath && strcmp( libOutPath, "" ) != 0)
{
makeTarget = fullpath;
}
fout << this->ConvertToOutputPath(fullpath)
<< ":\n\tcd " << this->ConvertToOutputPath(path)
<< "; $(MAKE) $(MAKESILENT) cmake.depends"
<< "; $(MAKE) $(MAKESILENT) cmake.check_depends"
<< "; $(MAKE) $(MAKESILENT) -f cmake.check_depends"
<< "; $(MAKE) $(MAKESILENT) " << makeTarget << "\n\n";
}
bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2) bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2)
{ {

View File

@ -141,14 +141,11 @@ protected:
const char* command2 = 0, const char* command2 = 0,
const char* command3 = 0, const char* command3 = 0,
const char* command4 = 0); const char* command4 = 0);
virtual void OutputBuildLibraryInDir(std::ostream& fout, virtual void OutputBuildTargetInDir(std::ostream& fout,
const char* path, const char* path,
const char* library, const char* library,
const char* fullpath); const char* fullpath,
virtual void OutputBuildExecutableInDir(std::ostream& fout, const char* outputPath);
const char* path,
const char* library,
const char* fullpath);
///! return true if the two paths are the same ///! return true if the two paths are the same
virtual bool SamePath(const char* path1, const char* path2); virtual bool SamePath(const char* path1, const char* path2);
virtual std::string GetOutputExtension(const char* sourceExtension); virtual std::string GetOutputExtension(const char* sourceExtension);