summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx74
1 files changed, 32 insertions, 42 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 7abe109..09ccc2f 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -1664,81 +1664,71 @@ void cmLocalUnixMakefileGenerator::OutputInstallRules(std::ostream& fout)
break;
case cmTarget::INSTALL_FILES:
{
+ std::string sourcePath = m_Makefile->GetCurrentDirectory();
+ std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
+ sourcePath += "/";
+ binaryPath += "/";
const std::vector<std::string> &sf = l->second.GetSourceLists();
std::vector<std::string>::const_iterator i;
for (i = sf.begin(); i != sf.end(); ++i)
{
- fout << "\t@ echo \"Installing " << *i << " \"\n";
- fout << "\t@if [ -f " << *i << " ] ; then \\\n";
- // avoid using install-sh to install install-sh
- // does not work on windows....
- if(*i == "install-sh")
+ std::string f = *i;
+ if(f.substr(0, sourcePath.length()) == sourcePath)
{
- fout << "\t cp ";
+ f = f.substr(sourcePath.length());
}
- else
+ else if(f.substr(0, binaryPath.length()) == binaryPath)
{
- fout << "\t $(INSTALL_DATA) ";
+ f = f.substr(binaryPath.length());
}
- fout << *i
- << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
- fout << "\t elif [ -f $(CMAKE_CURRENT_SOURCE)/" << *i << " ] ; then \\\n";
+ fout << "\t@ echo \"Installing " << f.c_str() << " \"\n";
// avoid using install-sh to install install-sh
- // does not work on windows....
- if(*i == "install-sh")
+ // does not work on windows....
+ if(*i == "install-sh")
{
- fout << "\t cp ";
+ fout << "\t @cp ";
}
else
{
- fout << "\t $(INSTALL_DATA) ";
+ fout << "\t @$(INSTALL_DATA) ";
}
- fout << "$(CMAKE_CURRENT_SOURCE)/" << *i
- << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
- fout << "\telse \\\n";
- fout << "\t echo \" ERROR!!! Unable to find: " << *i
- << " \"; \\\n";
- fout << "\t fi\n";
+ fout << *i
+ << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
}
}
break;
case cmTarget::INSTALL_PROGRAMS:
{
+ std::string sourcePath = m_Makefile->GetCurrentDirectory();
+ std::string binaryPath = m_Makefile->GetCurrentOutputDirectory();
+ sourcePath += "/";
+ binaryPath += "/";
const std::vector<std::string> &sf = l->second.GetSourceLists();
std::vector<std::string>::const_iterator i;
for (i = sf.begin(); i != sf.end(); ++i)
{
- fout << "\t@ echo \"Installing " << *i << " \"\n";
- fout << "\t@if [ -f " << *i << " ] ; then \\\n";
- // avoid using install-sh to install install-sh
- // does not work on windows....
- if(*i == "install-sh")
+ std::string f = *i;
+ if(f.substr(0, sourcePath.length()) == sourcePath)
{
- fout << "\t cp ";
+ f = f.substr(sourcePath.length());
}
- else
+ else if(f.substr(0, binaryPath.length()) == binaryPath)
{
- fout << "\t $(INSTALL_PROGRAM) ";
+ f = f.substr(binaryPath.length());
}
- fout << *i
- << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
- fout << "\t elif [ -f $(CMAKE_CURRENT_SOURCE)/" << *i << " ] ; then \\\n";
+ fout << "\t@ echo \"Installing " << f.c_str() << " \"\n";
// avoid using install-sh to install install-sh
- // does not work on windows....
- if(*i == "install-sh")
+ // does not work on windows....
+ if(*i == "install-sh")
{
- fout << "\t cp ";
+ fout << "\t @cp ";
}
else
{
- fout << "\t $(INSTALL_PROGRAM) ";
+ fout << "\t @$(INSTALL_DATA) ";
}
- fout << "$(CMAKE_CURRENT_SOURCE)/" << *i
- << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "; \\\n";
- fout << "\telse \\\n";
- fout << "\t echo \" ERROR!!! Unable to find: " << *i
- << " \"; \\\n";
- fout << "\t fi\n";
+ fout << *i
+ << " $(DESTDIR)" << prefix << l->second.GetInstallPath() << "\n";
}
}
break;