summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.cxx
diff options
context:
space:
mode:
authorAmitha Perera <perera@cs.rpi.edu>2001-07-16 22:40:42 (GMT)
committerAmitha Perera <perera@cs.rpi.edu>2001-07-16 22:40:42 (GMT)
commite169953e923907706439c60033ce983729c2e404 (patch)
treef12edb22a3b64f621ea7d049312ec1a9102ee54e /Source/cmSourceFile.cxx
parentfdfe7a357e38f40d768e24412f7e49b7880c0fcc (diff)
downloadCMake-e169953e923907706439c60033ce983729c2e404.zip
CMake-e169953e923907706439c60033ce983729c2e404.tar.gz
CMake-e169953e923907706439c60033ce983729c2e404.tar.bz2
ENH: Source and header file extensions are in variables in cmMakefile.
AUX_SOURCE_DIRECTORY will only add files that have a "source" extension.
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r--Source/cmSourceFile.cxx104
1 files changed, 42 insertions, 62 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 2081575..152dc6e 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -48,7 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The class must be found in dir and end in name.cxx, name.txx,
// name.c or it will be considered a header file only class
// and not included in the build process
-void cmSourceFile::SetName(const char* name, const char* dir)
+void cmSourceFile::SetName(const char* name, const char* dir,
+ const std::vector<std::string>& sourceExts,
+ const std::vector<std::string>& headerExts)
{
m_HeaderFileOnly = true;
@@ -94,81 +96,59 @@ void cmSourceFile::SetName(const char* name, const char* dir)
return;
}
- // Try various extentions
- hname = pathname;
- hname += ".cxx";
- if(cmSystemTools::FileExists(hname.c_str()))
- {
- m_SourceExtension = "cxx";
- m_HeaderFileOnly = false;
- m_FullPath = hname;
- return;
- }
-
- hname = pathname;
- hname += ".c";
- if(cmSystemTools::FileExists(hname.c_str()))
- {
- m_HeaderFileOnly = false;
- m_SourceExtension = "c";
- m_FullPath = hname;
- return;
- }
- hname = pathname;
- hname += ".txx";
- if(cmSystemTools::FileExists(hname.c_str()))
- {
- m_HeaderFileOnly = false;
- m_SourceExtension = "txx";
- m_FullPath = hname;
- return;
- }
- //
- hname = pathname;
- hname += ".cpp";
- if(cmSystemTools::FileExists(hname.c_str()))
+ // Next, try the various source extensions
+ for( std::vector<std::string>::const_iterator ext = sourceExts.begin();
+ ext != sourceExts.end(); ++ext )
{
- m_SourceExtension = "cpp";
- m_HeaderFileOnly = false;
- m_FullPath = hname;
- return;
+ hname = pathname;
+ hname += ".";
+ hname += *ext;
+ if(cmSystemTools::FileExists(hname.c_str()))
+ {
+ m_SourceExtension = *ext;
+ m_HeaderFileOnly = false;
+ m_FullPath = hname;
+ return;
+ }
}
- hname = pathname;
- hname += ".m";
- if(cmSystemTools::FileExists(hname.c_str()))
+ // Finally, try the various header extensions
+ for( std::vector<std::string>::const_iterator ext = headerExts.begin();
+ ext != headerExts.end(); ++ext )
{
- m_SourceExtension = "m";
- m_HeaderFileOnly = false;
- m_FullPath = hname;
- return;
+ hname = pathname;
+ hname += ".";
+ hname += *ext;
+ if(cmSystemTools::FileExists(hname.c_str()))
+ {
+ m_SourceExtension = *ext;
+ m_FullPath = hname;
+ return;
+ }
}
- hname = pathname;
- hname += ".M";
- if(cmSystemTools::FileExists(hname.c_str()))
+ std::string errorMsg = "Tried";
+ for( std::vector<std::string>::const_iterator ext = sourceExts.begin();
+ ext != sourceExts.end(); ++ext )
{
- m_SourceExtension = "M";
- m_HeaderFileOnly = false;
- m_FullPath = hname;
- return;
+ errorMsg += " .";
+ errorMsg += *ext;
}
-
- hname = pathname;
- hname += ".h";
- if(cmSystemTools::FileExists(hname.c_str()))
+ for( std::vector<std::string>::const_iterator ext = headerExts.begin();
+ ext != headerExts.end(); ++ext )
{
- m_SourceExtension = "h";
- m_FullPath = hname;
- return;
+ errorMsg += " .";
+ errorMsg += *ext;
}
+ errorMsg += " for ";
- cmSystemTools::Error("can not find file ", hname.c_str());
- cmSystemTools::Error("Tried .cxx .c .txx .cpp .m .M .h for ", hname.c_str());
+ cmSystemTools::Error("can not find file ", pathname.c_str());
+ cmSystemTools::Error(errorMsg.c_str(), pathname.c_str());
}
+
void cmSourceFile::SetName(const char* name, const char* dir, const char *ext,
- bool hfo)
+ bool hfo)
{
m_HeaderFileOnly = hfo;
m_SourceName = name;