summaryrefslogtreecommitdiff
path: root/Source/cmSubdirCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-03-14 11:29:15 -0500
committerKen Martin <ken.martin@kitware.com>2005-03-14 11:29:15 -0500
commit791aa6052b9033e89645b324b1c99222936981df (patch)
treefdd95f48321d8074e4c97eaba0b03da3e885d409 /Source/cmSubdirCommand.cxx
parentf7c024df2a2ae6b8cf5ba127ee764a55f81f06e6 (diff)
downloadcmake-791aa6052b9033e89645b324b1c99222936981df.tar.gz
ENH: add support for out of source source
Diffstat (limited to 'Source/cmSubdirCommand.cxx')
-rw-r--r--Source/cmSubdirCommand.cxx27
1 files changed, 22 insertions, 5 deletions
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx
index e2c52bd002..56cae36249 100644
--- a/Source/cmSubdirCommand.cxx
+++ b/Source/cmSubdirCommand.cxx
@@ -41,16 +41,33 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args)
preorder = true;
continue;
}
- std::string directory = std::string(m_Makefile->GetCurrentDirectory()) +
- "/" + i->c_str();
- if ( cmSystemTools::FileIsDirectory(directory.c_str()) )
+
+ // if they specified a relative path then compute the full
+ std::string srcPath = std::string(m_Makefile->GetCurrentDirectory()) +
+ "/" + i->c_str();
+ if (cmSystemTools::FileIsDirectory(srcPath.c_str()))
+ {
+ std::string binPath =
+ std::string(m_Makefile->GetCurrentOutputDirectory()) +
+ "/" + i->c_str();
+ m_Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(),
+ intoplevel, preorder);
+ }
+ // otherwise it is a full path
+ else if ( cmSystemTools::FileIsDirectory(i->c_str()) )
{
- m_Makefile->AddSubDirectory(i->c_str(), intoplevel, preorder);
+ // we must compute the binPath from the srcPath, we just take the last
+ // element from the source path and use that
+ std::string binPath =
+ std::string(m_Makefile->GetCurrentOutputDirectory()) +
+ "/" + cmSystemTools::GetFilenameName(i->c_str());
+ m_Makefile->AddSubDirectory(i->c_str(), binPath.c_str(),
+ intoplevel, preorder);
}
else
{
std::string error = "Incorrect SUBDIRS command. Directory: ";
- error += directory + " does not exists.";
+ error += *i + " does not exists.";
this->SetError(error.c_str());
res = false;
}