diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-03-14 16:29:15 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-03-14 16:29:15 (GMT) |
commit | 791aa6052b9033e89645b324b1c99222936981df (patch) | |
tree | fdd95f48321d8074e4c97eaba0b03da3e885d409 /Source/cmSubdirCommand.cxx | |
parent | f7c024df2a2ae6b8cf5ba127ee764a55f81f06e6 (diff) | |
download | CMake-791aa6052b9033e89645b324b1c99222936981df.zip CMake-791aa6052b9033e89645b324b1c99222936981df.tar.gz CMake-791aa6052b9033e89645b324b1c99222936981df.tar.bz2 |
ENH: add support for out of source source
Diffstat (limited to 'Source/cmSubdirCommand.cxx')
-rw-r--r-- | Source/cmSubdirCommand.cxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index e2c52bd..56cae36 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; } |