diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-26 21:32:56 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-26 21:32:56 (GMT) |
commit | d6090a2395a2e8e0c506e62a95e0e9dd197c6572 (patch) | |
tree | 3030c69e7dcc93a84fe308a73db6b45044661d4b /Source/cmSourceFile.cxx | |
parent | 62fec96d993975775410ebc2dceaa65b03a12ae2 (diff) | |
download | CMake-d6090a2395a2e8e0c506e62a95e0e9dd197c6572.zip CMake-d6090a2395a2e8e0c506e62a95e0e9dd197c6572.tar.gz CMake-d6090a2395a2e8e0c506e62a95e0e9dd197c6572.tar.bz2 |
ENH: When source file is in subdirectory put object file in subdirectory. Fixes Bug #290 - Source files in subdirectories should produce object files in subdirectories
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r-- | Source/cmSourceFile.cxx | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 138d5d2..b8a547a 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -27,9 +27,16 @@ void cmSourceFile::SetName(const char* name, const char* dir, const std::vector<std::string>& sourceExts, const std::vector<std::string>& headerExts) { + this->SetProperty("HEADER_FILE_ONLY","1"); - m_SourceName = name; + m_SourceName = cmSystemTools::GetFilenamePath(name); + if ( m_SourceName.size() > 0 ) + { + m_SourceName += "/"; + } + m_SourceName += cmSystemTools::GetFilenameWithoutLastExtension(name); + std::string pathname = dir; // the name might include the full path already, so @@ -47,7 +54,7 @@ void cmSourceFile::SetName(const char* name, const char* dir, // First try and see whether the listed file can be found // as is without extensions added on. - pathname += m_SourceName; + pathname += name; std::string hname = pathname; if(cmSystemTools::FileExists(hname.c_str())) { @@ -55,14 +62,13 @@ void cmSourceFile::SetName(const char* name, const char* dir, if(pos != std::string::npos) { m_SourceExtension = hname.substr(pos+1, hname.size()-pos); - std::string::size_type pos2 = hname.rfind('/'); - if(pos2 != std::string::npos) + if ( cmSystemTools::FileIsFullPath(name) ) { + std::string::size_type pos2 = hname.rfind('/'); + if(pos2 != std::string::npos) + { m_SourceName = hname.substr(pos2+1, pos - pos2-1); - } - else - { - m_SourceName = hname.substr(0, pos); + } } } |