summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmAbstractFilesCommand.cxx30
-rw-r--r--Source/cmBorlandMakefileGenerator.cxx12
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmCreateTestSourceList.cxx1
-rw-r--r--Source/cmDSPWriter.cxx52
-rw-r--r--Source/cmFLTKWrapUICommand.cxx7
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx55
-rw-r--r--Source/cmGetSourceFilePropertyCommand.h66
-rw-r--r--Source/cmInstallFilesCommand.cxx6
-rw-r--r--Source/cmMSDotNETGenerator.cxx28
-rw-r--r--Source/cmMakeDepend.cxx16
-rw-r--r--Source/cmMakefile.cxx60
-rw-r--r--Source/cmMakefile.h13
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx8
-rw-r--r--Source/cmQTWrapCPPCommand.cxx4
-rw-r--r--Source/cmQTWrapUICommand.cxx4
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.cxx136
-rw-r--r--Source/cmSetSourceFilesPropertiesCommand.h66
-rw-r--r--Source/cmSourceFile.cxx13
-rw-r--r--Source/cmSourceFilesCommand.cxx8
-rw-r--r--Source/cmSourceFilesFlagsCommand.cxx22
-rw-r--r--Source/cmTarget.cxx6
-rw-r--r--Source/cmTarget.h8
-rw-r--r--Source/cmUnixMakefileGenerator.cxx96
-rw-r--r--Source/cmVTKMakeInstantiatorCommand.cxx12
-rw-r--r--Source/cmVTKWrapJavaCommand.cxx4
-rw-r--r--Source/cmVTKWrapPythonCommand.cxx4
-rw-r--r--Source/cmVTKWrapTclCommand.cxx4
-rw-r--r--Source/cmWrapExcludeFilesCommand.cxx6
-rw-r--r--Source/cmaketest.cxx21
-rw-r--r--Source/cmaketest.h.in1
31 files changed, 593 insertions, 180 deletions
diff --git a/Source/cmAbstractFilesCommand.cxx b/Source/cmAbstractFilesCommand.cxx
index 9c43968..32a6237 100644
--- a/Source/cmAbstractFilesCommand.cxx
+++ b/Source/cmAbstractFilesCommand.cxx
@@ -24,23 +24,29 @@ bool cmAbstractFilesCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("called with incorrect number of arguments");
return false;
}
+ bool ret = true;
+ std::string m = "could not find source file(s):\n";
+
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::const_iterator j = args.begin();
j != args.end(); ++j)
- {
- for(cmMakefile::SourceMap::iterator l = Classes.begin();
- l != Classes.end(); l++)
+ {
+ cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
+ if(sf)
{
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
- i != l->second.end(); i++)
- {
- if(i->GetSourceName() == (*j))
- {
- i->SetIsAnAbstractClass(true);
- }
- }
+ sf->SetIsAnAbstractClass(true);
}
+ else
+ {
+ m += *j;
+ m += "\n";
+ ret = false;
+ }
+ }
+ if(!ret)
+ {
+ this->SetError(m.c_str());
}
- return true;
+ return ret;
}
diff --git a/Source/cmBorlandMakefileGenerator.cxx b/Source/cmBorlandMakefileGenerator.cxx
index fa69791..17197a0 100644
--- a/Source/cmBorlandMakefileGenerator.cxx
+++ b/Source/cmBorlandMakefileGenerator.cxx
@@ -161,7 +161,11 @@ OutputBuildObjectFromSource(std::ostream& fout,
}
// Header files shouldn't have build rules.
if(source.IsAHeaderFileOnly())
+ {
return;
+ }
+
+
std::string comment = "Build ";
std::string objectFile = std::string(shortName) +
@@ -248,14 +252,14 @@ void cmBorlandMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
command += " $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") ";
std::string command2 = "implib -w ";
command2 += libpath + " " + target;
- const std::vector<cmSourceFile>& sources = t.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator i = sources.begin();
+ const std::vector<cmSourceFile*>& sources = t.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
- if(i->GetSourceExtension() == "def")
+ if((*i)->GetSourceExtension() == "def")
{
command += "";
- command += i->GetFullPath();
+ command += (*i)->GetFullPath();
}
}
command += "\n|\n";
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index 4cec8ae..26e9f06 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -46,6 +46,7 @@
#include "cmForEachCommand.cxx"
#include "cmFLTKWrapUICommand.cxx"
#include "cmGetFilenameComponentCommand.cxx"
+#include "cmGetSourceFilePropertyCommand.cxx"
#include "cmIfCommand.cxx"
#include "cmIncludeCommand.cxx"
#include "cmIncludeDirectoryCommand.cxx"
@@ -64,6 +65,7 @@
#include "cmOutputRequiredFilesCommand.cxx"
#include "cmProjectCommand.cxx"
#include "cmSetCommand.cxx"
+#include "cmSetSourceFilesPropertiesCommand.cxx"
#include "cmSiteNameCommand.cxx"
#include "cmSourceFilesCommand.cxx"
#include "cmSourceFilesFlagsCommand.cxx"
@@ -113,6 +115,7 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmForEachCommand);
commands.push_back(new cmFLTKWrapUICommand);
commands.push_back(new cmGetFilenameComponentCommand);
+ commands.push_back(new cmGetSourceFilePropertyCommand);
commands.push_back(new cmIfCommand);
commands.push_back(new cmIncludeCommand);
commands.push_back(new cmIncludeDirectoryCommand);
@@ -131,6 +134,7 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
commands.push_back(new cmOutputRequiredFilesCommand);
commands.push_back(new cmProjectCommand);
commands.push_back(new cmSetCommand);
+ commands.push_back(new cmSetSourceFilesPropertiesCommand);
commands.push_back(new cmSiteNameCommand);
commands.push_back(new cmSourceFilesCommand);
commands.push_back(new cmSourceFilesFlagsCommand);
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 7627cc1..d9c33be 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -60,6 +60,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"#include <ctype.h>\n"
"#include <stdio.h>\n"
"#include <string.h>\n"
+
"\n"
"// Forward declare test functions\n"
"\n";
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx
index 6eacd98..867961c 100644
--- a/Source/cmDSPWriter.cxx
+++ b/Source/cmDSPWriter.cxx
@@ -104,6 +104,18 @@ void cmDSPWriter::OutputDSPFile()
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
&& (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
{
+ // check to see if the dsp is going into a sub-directory
+ std::string::size_type pos = l->first.rfind('/');
+ if(pos != std::string::npos)
+ {
+ std::string dir = m_Makefile->GetStartOutputDirectory();
+ dir += "/";
+ dir += l->first.substr(0, pos);
+ if(!cmSystemTools::MakeDirectory(dir.c_str()))
+ {
+ cmSystemTools::Error("Error creating directory ", dir.c_str());
+ }
+ }
this->CreateSingleDSP(l->first.c_str(),l->second);
}
}
@@ -201,15 +213,15 @@ void cmDSPWriter::WriteDSPFile(std::ostream& fout,
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
// get the classes from the source lists then add them to the groups
- std::vector<cmSourceFile> classes = target.GetSourceFiles();
- for(std::vector<cmSourceFile>::iterator i = classes.begin();
+ std::vector<cmSourceFile*> classes = target.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); i++)
{
// Add the file to the list of sources.
- std::string source = i->GetFullPath();
+ std::string source = (*i)->GetFullPath();
cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
sourceGroups);
- sourceGroup.AddSource(source.c_str(), &(*i));
+ sourceGroup.AddSource(source.c_str(), *i);
}
// add any custom rules to the source groups
@@ -785,25 +797,19 @@ void cmDSPWriter::WriteDSPHeader(std::ostream& fout, const char *libName,
cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES",
m_Makefile->GetDefineFlags());
- cmSystemTools::ReplaceString(line,
- "CMAKE_CXX_FLAGS_RELEASE",
- m_Makefile->
- GetDefinition("CMAKE_CXX_FLAGS_RELEASE"));
- cmSystemTools::ReplaceString(line,
- "CMAKE_CXX_FLAGS_MINSIZEREL",
- m_Makefile->
- GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL")
- );
- cmSystemTools::ReplaceString(line,
- "CMAKE_CXX_FLAGS_DEBUG",
- m_Makefile->
- GetDefinition("CMAKE_CXX_FLAGS_DEBUG"));
- cmSystemTools::ReplaceString(line,
- "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
- m_Makefile->
- GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO"));
- cmSystemTools::ReplaceString(line,
- "CMAKE_CXX_FLAGS",
+ std::string flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE");
+ flags += " -DCMAKE_INTDIR=\\\"Release\\\"";
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flags.c_str());
+ flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL");
+ flags += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\"";
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flags.c_str());
+ flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG");
+ flags += " -DCMAKE_INTDIR=\\\"Debug\\\"";
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flags.c_str());
+ flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO");
+ flags += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\"";
+ cmSystemTools::ReplaceString(line,"CMAKE_CXX_FLAGS_RELWITHDEBINFO", flags.c_str());
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS",
m_Makefile->
GetDefinition("CMAKE_CXX_FLAGS"));
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index f78a1ff..6eb7280 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -64,10 +64,10 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
// where they are created have to be added to the include path
m_Makefile->AddIncludeDirectory( outputDirectory.c_str() );
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should use the source GUI
// to generate .cxx and .h files
if (!curr.GetWrapExclude())
@@ -139,8 +139,9 @@ void cmFLTKWrapUICommand::FinalPass()
m_Makefile->AddCustomCommand(m_WrapUserInterface[classNum].c_str(),
fluid_exe.c_str(), cxxargs, depends,
outputs, m_Target.c_str() );
+ cmSourceFile* sf = m_Makefile->AddSource(m_GeneratedSourcesClasses[classNum]);
- m_Makefile->GetTargets()[m_Target].GetSourceFiles().push_back( m_GeneratedSourcesClasses[classNum] );
+ m_Makefile->GetTargets()[m_Target].GetSourceFiles().push_back( sf );
}
}
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
new file mode 100644
index 0000000..12a6dcd
--- /dev/null
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -0,0 +1,55 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Insight Consortium. All rights reserved.
+ See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmGetSourceFilePropertyCommand.h"
+
+// cmSetSourceFilePropertyCommand
+bool cmGetSourceFilePropertyCommand::InitialPass(std::vector<std::string> const&
+ args)
+{
+ if(args.size() < 3 )
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+ const char* var = args[0].c_str();
+ const char* file = args[1].c_str();
+ cmSourceFile* sf = m_Makefile->GetSource(file);
+ if(sf)
+ {
+ if(args[2] == "ABSTRACT")
+ {
+ m_Makefile->AddDefinition(var, sf->IsAnAbstractClass());
+ }
+ if(args[2] == "WRAP_EXCLUDE")
+ {
+ m_Makefile->AddDefinition(var, sf->GetWrapExclude());
+ }
+ if(args[2] == "FLAGS")
+ {
+ m_Makefile->AddDefinition(var, sf->GetCompileFlags());
+ }
+ }
+ else
+ {
+ std::string m = "Could not find source file: ";
+ m += file;
+ this->SetError(m.c_str());
+ return false;
+ }
+ return true;
+}
+
diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h
new file mode 100644
index 0000000..2e5aa0a
--- /dev/null
+++ b/Source/cmGetSourceFilePropertyCommand.h
@@ -0,0 +1,66 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Insight Consortium. All rights reserved.
+ See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmGetSourceFilePropertyCommand_h
+#define cmGetSourceFilePropertyCommand_h
+
+#include "cmStandardIncludes.h"
+#include "cmCommand.h"
+
+class cmGetSourceFilePropertyCommand : public cmCommand
+{
+public:
+ virtual cmCommand* Clone()
+ {
+ return new cmGetSourceFilePropertyCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the input file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "GET_SOURCE_FILE_PROPERTY";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Set attributes for a specific list of files.";
+ }
+
+ /**
+ * Longer documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ "GET_SOURCE_FILE_PROPERTY(VAR file [ABSTRACT|WRAP_EXCLUDE|FLAGS]) "
+ "Get properties on a file. The syntax for the command is to list all the files you want "
+ "to change, and then provide the values you want to set next.";
+ }
+
+ cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand);
+};
+
+
+
+#endif
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 8874957..87cdd38 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -64,12 +64,12 @@ void cmInstallFilesCommand::FinalPass()
// look for a srclist
if (m_Makefile->GetSources().find(temps) != m_Makefile->GetSources().end())
{
- const std::vector<cmSourceFile> &clsList =
+ const std::vector<cmSourceFile*> &clsList =
m_Makefile->GetSources().find(temps)->second;
- std::vector<cmSourceFile>::const_iterator c = clsList.begin();
+ std::vector<cmSourceFile*>::const_iterator c = clsList.begin();
for (; c != clsList.end(); ++c)
{
- testf = c->GetSourceName() + ext;
+ testf = (*c)->GetSourceName() + ext;
// add to the result
targetSourceLists.push_back(testf);
}
diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx
index fb6921c..71682c6 100644
--- a/Source/cmMSDotNETGenerator.cxx
+++ b/Source/cmMSDotNETGenerator.cxx
@@ -720,9 +720,11 @@ void cmMSDotNETGenerator::WriteConfiguration(std::ostream& fout,
<< "\t\t\tCharacterSet=\"2\">\n";
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"VCCLCompilerTool\"\n"
- << "\t\t\t\tAdditionalOptions=\"" <<
- m_Makefile->GetDefinition("CMAKE_CXX_FLAGS") << "\"\n";
-
+ << "\t\t\t\tAdditionalOptions=\""
+ << m_Makefile->GetDefinition("CMAKE_CXX_FLAGS")
+ << " -DCMAKE_INTDIR=\\&quot;" << configName << "\\&quot;"
+ << "\"\n";
+
fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i = includes.begin();
@@ -891,14 +893,14 @@ void cmMSDotNETGenerator::OutputBuildTool(std::ostream& fout,
void cmMSDotNETGenerator::OutputModuleDefinitionFile(std::ostream& fout,
const cmTarget &target)
{
- std::vector<cmSourceFile> const& classes = target.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator i = classes.begin();
+ std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); i++)
{
- if(cmSystemTools::UpperCase(i->GetSourceExtension()) == "DEF")
+ if(cmSystemTools::UpperCase((*i)->GetSourceExtension()) == "DEF")
{
fout << "\t\t\t\tModuleDefinitionFile=\""
- << this->ConvertToXMLOutputPath(i->GetFullPath().c_str())
+ << this->ConvertToXMLOutputPath((*i)->GetFullPath().c_str())
<< "\"\n";
return;
}
@@ -1011,20 +1013,20 @@ void cmMSDotNETGenerator::WriteVCProjFile(std::ostream& fout,
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
// get the classes from the source lists then add them to the groups
- std::vector<cmSourceFile> const& classes = target.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator i = classes.begin();
+ std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); i++)
{
// Add the file to the list of sources.
- std::string source = i->GetFullPath();
- if(cmSystemTools::UpperCase(i->GetSourceExtension()) == "DEF")
+ std::string source = (*i)->GetFullPath();
+ if(cmSystemTools::UpperCase((*i)->GetSourceExtension()) == "DEF")
{
- m_ModuleDefinitionFile = i->GetFullPath();
+ m_ModuleDefinitionFile = (*i)->GetFullPath();
}
cmSourceGroup& sourceGroup = m_Makefile->FindSourceGroup(source.c_str(),
sourceGroups);
- sourceGroup.AddSource(source.c_str(), &(*i));
+ sourceGroup.AddSource(source.c_str(), *i);
}
// add any custom rules to the source groups
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index 3858af9..78a7c1f 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -147,10 +147,10 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
cmMakefile::SourceMap::iterator l;
for (l= srcmap.begin() ; l!=srcmap.end() ; l++)
{
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- if (i->GetFullPath() == path)
+ if ((*i)->GetFullPath() == path)
{
found=true;
}
@@ -164,7 +164,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
std::string incpath = *t;
incpath = incpath + "/";
incpath = incpath + path;
- if (i->GetFullPath() == incpath)
+ if ((*i)->GetFullPath() == incpath)
{
// set the path to the guessed path
info->m_FullPath = incpath;
@@ -272,16 +272,16 @@ void cmMakeDepend::GenerateMakefileDependencies()
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
{
- const std::vector<cmSourceFile> &classes = l->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator i = classes.begin();
+ const std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); ++i)
{
- if(!i->GetIsAHeaderFileOnly())
+ if(!(*i)->GetIsAHeaderFileOnly())
{
cmDependInformation* info =
- this->GetDependInformation(i->GetFullPath().c_str());
+ this->GetDependInformation((*i)->GetFullPath().c_str());
this->AddFileToSearchPath(info->m_FullPath.c_str());
- info->m_cmSourceFile = &*i;
+ info->m_cmSourceFile = *i;
this->GenerateDependInformation(info);
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index aa2b80b..b713395 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -104,6 +104,11 @@ void cmMakefile::AddDefaultCommands()
cmMakefile::~cmMakefile()
{
+ for(std::vector<cmSourceFile*>::iterator i = m_SourceFiles.begin();
+ i != m_SourceFiles.end(); ++i)
+ {
+ delete *i;
+ }
for(unsigned int i=0; i < m_UsedCommands.size(); i++)
{
delete m_UsedCommands[i];
@@ -153,10 +158,10 @@ void cmMakefile::Print() const
l != m_Sources.end(); l++)
{
std::cout << " Class list named: " << l->first << std::endl;
- for(std::vector<cmSourceFile>::const_iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::const_iterator i = l->second.begin();
i != l->second.end(); i++)
{
- i->Print();
+ (*i)->Print();
}
}
@@ -361,12 +366,12 @@ cmSourceFile *cmMakefile::GetSource(const char *srclist, const char *cname)
return 0;
}
// find the class
- for (std::vector<cmSourceFile>::iterator i = sl->second.begin();
+ for (std::vector<cmSourceFile*>::iterator i = sl->second.begin();
i != sl->second.end(); ++i)
{
- if (i->GetSourceName() == cname)
+ if ((*i)->GetSourceName() == cname)
{
- return &(*i);
+ return *i;
}
}
return 0;
@@ -423,24 +428,23 @@ void cmMakefile::GenerateMakefile()
void cmMakefile::AddSource(cmSourceFile& cmfile, const char *srclist)
{
- m_Sources[srclist].push_back(cmfile);
+ m_Sources[srclist].push_back(this->AddSource(cmfile));
}
-struct FindSrcByName : std::binary_function<cmSourceFile, cmSourceFile, bool>
+struct FindSrcByName : std::binary_function<cmSourceFile*, cmSourceFile*, bool>
{
public:
- bool operator () (const cmSourceFile &f, const cmSourceFile &test) const
+ bool operator () (const cmSourceFile *f, const cmSourceFile *test) const
{
- return !strcmp(f.GetSourceName().c_str(),test.GetSourceName().c_str());
+ return (f->GetSourceName() == test->GetSourceName());
}
};
void cmMakefile::RemoveSource(cmSourceFile& cmfile,const char *srclist)
{
- std::vector<cmSourceFile> &maplist = m_Sources[srclist];
- std::vector<cmSourceFile>::iterator f =
- std::find_if(maplist.begin(), maplist.end(), std::bind2nd(FindSrcByName(),cmfile));
-// std::vector<cmSourceFile>::iterator f = find_if(maplist.begin(), maplist.end(), matches(srclist);
+ std::vector<cmSourceFile*> &maplist = m_Sources[srclist];
+ std::vector<cmSourceFile*>::iterator f =
+ std::find_if(maplist.begin(), maplist.end(), std::bind2nd(FindSrcByName(),&cmfile));
if (f!=maplist.end())
{
maplist.erase(f);
@@ -1288,3 +1292,33 @@ cmData* cmMakefile::LookupData(const char* name) const
}
}
+cmSourceFile* cmMakefile::GetSource(const char* sourceName)
+{
+ for(std::vector<cmSourceFile*>::iterator i = m_SourceFiles.begin();
+ i != m_SourceFiles.end(); ++i)
+ {
+ if((*i)->GetSourceName() == sourceName
+ || (*i)->GetSourceName()+"."+(*i)->GetSourceExtension() == sourceName)
+ {
+ return *i;
+ }
+ }
+ return 0;
+}
+
+
+
+cmSourceFile* cmMakefile::AddSource(cmSourceFile const&sf)
+{
+ // check to see if it exists
+ cmSourceFile* ret = this->GetSource(sf.GetSourceName().c_str());
+ if(ret && ret->GetSourceExtension() == sf.GetSourceExtension())
+ {
+ return ret;
+ }
+ ret = new cmSourceFile(sf);
+ m_SourceFiles.push_back(ret);
+ return ret;
+}
+
+
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 49f5693..e758b96 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -401,10 +401,17 @@ public:
/**
* Return a list of source files in this makefile.
*/
- typedef std::map<cmStdString,std::vector<cmSourceFile> > SourceMap;
+ typedef std::map<cmStdString,std::vector<cmSourceFile*> > SourceMap;
const SourceMap &GetSources() const {return m_Sources;}
SourceMap &GetSources() {return m_Sources;}
- cmSourceFile *GetSource(const char *srclist, const char *sourceName);
+ cmSourceFile* GetSource(const char *srclist, const char *sourceName);
+
+ /** Get a cmSourceFile pointer for a given source name, if the name is
+ * not found, then a null pointer is returned.
+ */
+ cmSourceFile* GetSource(const char* sourceName);
+ ///! Add a new cmSourceFile to the list of sources for this makefile.
+ cmSourceFile* AddSource(cmSourceFile const&);
/**
* Obtain a list of auxiliary source directories.
@@ -533,6 +540,8 @@ protected:
// libraries, classes, and executables
cmTargets m_Targets;
SourceMap m_Sources;
+ std::vector<cmSourceFile*> m_SourceFiles;
+
std::vector<std::string> m_SubDirectories; // list of sub directories
struct StringSet : public std::set<cmStdString>
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index e88fc21..fb52361 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -445,14 +445,14 @@ void cmNMakeMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
command += linklibs.str();
delete [] linklibs.str();
- const std::vector<cmSourceFile>& sources = t.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator i = sources.begin();
+ const std::vector<cmSourceFile*>& sources = t.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
- if(i->GetSourceExtension() == "def")
+ if((*i)->GetSourceExtension() == "def")
{
command += "/DEF:";
- command += i->GetFullPath();
+ command += (*i)->GetFullPath();
}
}
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 8a1a044..0a82c26 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -60,10 +60,10 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("bad source list passed to QTWrapCPPCommand");
return false;
}
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
{
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index 4dc651a..b34e36d 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -61,10 +61,10 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args)
this->SetError("bad source list passed to QTWrapUICommand");
return false;
}
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
{
diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx
new file mode 100644
index 0000000..06581eb
--- /dev/null
+++ b/Source/cmSetSourceFilesPropertiesCommand.cxx
@@ -0,0 +1,136 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Insight Consortium. All rights reserved.
+ See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmSetSourceFilesPropertiesCommand.h"
+
+// cmSetSourceFilesPropertiesCommand
+bool cmSetSourceFilesPropertiesCommand::InitialPass(std::vector<std::string> const&
+ args)
+{
+ if(args.size() < 2 )
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
+
+ std::vector<std::string>::const_iterator j;
+ // first collect up all the flags that need to be set on the file
+ bool abstract = false;
+ bool wrap_exclude = false;
+ bool generated = false;
+ std::string flags;
+ for(j= args.begin(); j != args.end();++j)
+ {
+ if(*j == "ABSTRACT")
+ {
+ abstract = true;
+ }
+ else if(*j == "WRAP_EXCLUDE")
+ {
+ wrap_exclude = true;
+ }
+ else if(*j == "GENERATED")
+ {
+ generated = true;
+ }
+ else if(*j == "FLAGS")
+ {
+ ++j;
+ if(j == args.end())
+ {
+ this->SetError("called with incorrect number of arguments FLAGS with no flags");
+ return false;
+ }
+ flags = *j;
+ }
+ }
+ // now loop over all the files
+ for(j = args.begin(); j != args.end(); ++j)
+ {
+ // at the sign of the first property exit the loop
+ if(*j == "ABSTRACT" || *j == "WRAP_EXCLUDE" || *j == "FLAGS")
+ {
+ break;
+ }
+ // if the file is already in the makefile just set properites on it
+ cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
+ if(sf)
+ {
+ if(flags.size())
+ {
+ sf->SetCompileFlags(flags.c_str());
+ }
+ sf->SetIsAnAbstractClass(abstract);
+ sf->SetWrapExclude(wrap_exclude);
+ }
+ // if file is not already in the makefile, then add it
+ else
+ {
+ std::string newfile = *j;
+ cmSourceFile file;
+ std::string path = cmSystemTools::GetFilenamePath(newfile);
+ // set the flags
+ file.SetIsAnAbstractClass(abstract);
+ file.SetWrapExclude(wrap_exclude);
+ if(flags.size())
+ {
+ file.SetCompileFlags(flags.c_str());
+ }
+ if(generated)
+ {
+ std::string ext = cmSystemTools::GetFilenameExtension(newfile);
+ std::string name_no_ext = cmSystemTools::GetFilenameName(newfile.c_str());
+ name_no_ext = name_no_ext.substr(0, name_no_ext.length()-ext.length());
+ if ( ext.length() && ext[0] == '.' )
+ {
+ ext = ext.substr(1);
+ }
+ if((path.size() && path[0] == '/') ||
+ (path.size() > 1 && path[1] == ':'))
+ {
+ file.SetName(name_no_ext.c_str(), path.c_str(), ext.c_str(), false);
+ }
+ else
+ {
+ file.SetName(name_no_ext.c_str(), m_Makefile->GetCurrentOutputDirectory(),
+ ext.c_str(), false);
+ }
+ }
+ else
+ {
+ // if this is a full path then
+ if((path.size() && path[0] == '/') ||
+ (path.size() > 1 && path[1] == ':'))
+ {
+ file.SetName(cmSystemTools::GetFilenameName(newfile.c_str()).c_str(),
+ path.c_str(),
+ m_Makefile->GetSourceExtensions(),
+ m_Makefile->GetHeaderExtensions());
+ }
+ else
+ {
+ file.SetName(newfile.c_str(), m_Makefile->GetCurrentDirectory(),
+ m_Makefile->GetSourceExtensions(),
+ m_Makefile->GetHeaderExtensions());
+ }
+ }
+ // add the source file to the makefile
+ m_Makefile->AddSource(file);
+ }
+ }
+ return true;
+}
+
diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h
new file mode 100644
index 0000000..7ad974b
--- /dev/null
+++ b/Source/cmSetSourceFilesPropertiesCommand.h
@@ -0,0 +1,66 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+ Copyright (c) 2002 Insight Consortium. All rights reserved.
+ See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmSetSourceFilesPropertiesCommand_h
+#define cmSetSourceFilesPropertiesCommand_h
+
+#include "cmStandardIncludes.h"
+#include "cmCommand.h"
+
+class cmSetSourceFilesPropertiesCommand : public cmCommand
+{
+public:
+ virtual cmCommand* Clone()
+ {
+ return new cmSetSourceFilesPropertiesCommand;
+ }
+
+ /**
+ * This is called when the command is first encountered in
+ * the input file.
+ */
+ virtual bool InitialPass(std::vector<std::string> const& args);
+
+ /**
+ * The name of the command as specified in CMakeList.txt.
+ */
+ virtual const char* GetName() { return "SET_SOURCE_FILES_PROPERTIES";}
+
+ /**
+ * Succinct documentation.
+ */
+ virtual const char* GetTerseDocumentation()
+ {
+ return "Set attributes for a specific list of files.";
+ }
+
+ /**
+ * Longer documentation.
+ */
+ virtual const char* GetFullDocumentation()
+ {
+ return
+ "SET_SOURCE_FILES_PROPERTIES(flags file1 file2 [ABSTRACT|WRAP_EXCLUDE|GENERATED|FLAGS] [flags]) "
+ "Set properties on a file. The syntax for the command is to list all the files you want "
+ "to change, and then provide the values you want to set next.";
+ }
+
+ cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand);
+};
+
+
+
+#endif
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index c275a4c..43ebf52 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -151,19 +151,22 @@ void cmSourceFile::Print() const
{
if(m_AbstractClass)
{
- std::cout << "Abstract ";
+ std::cerr << "Abstract ";
}
else
{
- std::cout << "Concrete ";
+ std::cerr << "Concrete ";
}
if(m_HeaderFileOnly)
{
- std::cout << "Header file ";
+ std::cerr << "Header file ";
}
else
{
- std::cout << "CXX file ";
+ std::cerr << "CXX file ";
}
- std::cout << m_SourceName << std::endl;
+ std::cerr << "m_CompileFlags: " << m_CompileFlags << "\n";
+ std::cerr << "m_FullPath: " << m_FullPath << "\n";
+ std::cerr << "m_SourceName: " << m_SourceName << std::endl;
+ std::cerr << "m_SourceExtension: " << m_SourceExtension << "\n";
}
diff --git a/Source/cmSourceFilesCommand.cxx b/Source/cmSourceFilesCommand.cxx
index db87a76..b582551 100644
--- a/Source/cmSourceFilesCommand.cxx
+++ b/Source/cmSourceFilesCommand.cxx
@@ -40,6 +40,14 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& args)
generated = 1;
continue;
}
+ cmSourceFile* sf = m_Makefile->GetSource(copy.c_str());
+ if(sf)
+ {
+ // if the source file is already in the makefile,
+ // then add the pointer to the source list without creating a cmSourceFile
+ m_Makefile->GetSources()[name].push_back(sf);
+ continue;
+ }
cmSourceFile file;
file.SetIsAnAbstractClass(false);
std::string path = cmSystemTools::GetFilenamePath(copy);
diff --git a/Source/cmSourceFilesFlagsCommand.cxx b/Source/cmSourceFilesFlagsCommand.cxx
index 458cbd5..81a9114 100644
--- a/Source/cmSourceFilesFlagsCommand.cxx
+++ b/Source/cmSourceFilesFlagsCommand.cxx
@@ -25,23 +25,23 @@ bool cmSourceFilesFlagsCommand::InitialPass(std::vector<std::string> const&
this->SetError("called with incorrect number of arguments");
return false;
}
- cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
+
std::vector<std::string>::const_iterator j = args.begin();
std::string flags = *j;
++j;
for(;j != args.end(); ++j)
{
- for(cmMakefile::SourceMap::iterator l = Classes.begin();
- l != Classes.end(); l++)
+ cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
+ if(sf)
{
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
- i != l->second.end(); i++)
- {
- if(i->GetSourceName() == (*j) || i->GetSourceName()+"."+i->GetSourceExtension() == (*j))
- {
- i->SetCompileFlags(flags.c_str());
- }
- }
+ sf->SetCompileFlags(flags.c_str());
+ }
+ else
+ {
+ std::string m = "could not find source file ";
+ m += *j;
+ this->SetError(m.c_str());
+ return false;
}
}
return true;
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 12e35c1..603e04f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -17,7 +17,7 @@
#include "cmTarget.h"
#include "cmMakefile.h"
-void cmTarget::GenerateSourceFilesFromSourceLists(const cmMakefile &mf)
+void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
{
// this is only done for non install targets
if ((this->m_TargetType == cmTarget::INSTALL_FILES)
@@ -36,7 +36,7 @@ void cmTarget::GenerateSourceFilesFromSourceLists(const cmMakefile &mf)
// look for a srclist
if (mf.GetSources().find(temps) != mf.GetSources().end())
{
- const std::vector<cmSourceFile> &clsList =
+ const std::vector<cmSourceFile*> &clsList =
mf.GetSources().find(temps)->second;
// if we ahave a limited build list, use it
m_SourceFiles.insert(m_SourceFiles.end(),
@@ -51,7 +51,7 @@ void cmTarget::GenerateSourceFilesFromSourceLists(const cmMakefile &mf)
file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
mf.GetSourceExtensions(),
mf.GetHeaderExtensions());
- m_SourceFiles.push_back(file);
+ m_SourceFiles.push_back(mf.AddSource(file));
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 848dc41..7f3c8b7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -67,9 +67,9 @@ public:
/**
* Get the list of the source files used by this target
*/
- const std::vector<cmSourceFile> &GetSourceFiles() const
+ const std::vector<cmSourceFile*> &GetSourceFiles() const
{return m_SourceFiles;}
- std::vector<cmSourceFile> &GetSourceFiles() {return m_SourceFiles;}
+ std::vector<cmSourceFile*> &GetSourceFiles() {return m_SourceFiles;}
/**
* Get the list of the source files used by this target
@@ -95,7 +95,7 @@ public:
* Generate the SourceFilesList from the SourceLists. This should only be
* done once to be safe.
*/
- void GenerateSourceFilesFromSourceLists(const cmMakefile &mf);
+ void GenerateSourceFilesFromSourceLists(cmMakefile &mf);
/** Add a utility on which this project depends. A utility is an executable
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
@@ -109,7 +109,7 @@ private:
std::vector<cmCustomCommand> m_CustomCommands;
std::vector<std::string> m_SourceLists;
TargetType m_TargetType;
- std::vector<cmSourceFile> m_SourceFiles;
+ std::vector<cmSourceFile*> m_SourceFiles;
LinkLibraries m_LinkLibraries;
bool m_InAll;
std::string m_InstallPath;
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 83541c5..9cb2bce 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -110,18 +110,18 @@ void cmUnixMakefileGenerator::ProcessDepends(const cmMakeDepend &md)
cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
- std::vector<cmSourceFile> &classes = l->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::iterator i = classes.begin();
+ std::vector<cmSourceFile*> &classes = l->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); ++i)
{
- if(!i->GetIsAHeaderFileOnly())
+ if(!(*i)->GetIsAHeaderFileOnly())
{
// get the depends
const cmDependInformation *info =
- md.GetDependInformationForSourceFile(*i);
+ md.GetDependInformationForSourceFile(*(*i));
// Delete any hints from the source file's dependencies.
- i->GetDepends().erase(i->GetDepends().begin(), i->GetDepends().end());
+ (*i)->GetDepends().erase((*i)->GetDepends().begin(), (*i)->GetDepends().end());
// Now add the real dependencies for the file.
if (info)
@@ -134,7 +134,7 @@ void cmUnixMakefileGenerator::ProcessDepends(const cmMakeDepend &md)
// not found.
if((*d)->m_FullPath != "")
{
- i->GetDepends().push_back((*d)->m_FullPath);
+ (*i)->GetDepends().push_back((*d)->m_FullPath);
}
}
}
@@ -359,34 +359,34 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
{
- std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
+ std::vector<cmSourceFile*> classes = l->second.GetSourceFiles();
if (classes.begin() != classes.end())
{
fout << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS") << " = ";
- for(std::vector<cmSourceFile>::iterator i = classes.begin();
+ for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); i++)
{
- if(!i->IsAHeaderFileOnly())
+ if(!(*i)->IsAHeaderFileOnly())
{
- std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str()));
+ std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
if(outExt.size())
{
- fout << "\\\n" << this->ConvertToOutputPath(i->GetSourceName().c_str())
+ fout << "\\\n" << this->ConvertToOutputPath((*i)->GetSourceName().c_str())
<< outExt.c_str() << " ";
}
}
}
fout << "\n\n";
fout << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS_QUOTED") << " = ";
- for(std::vector<cmSourceFile>::iterator i = classes.begin();
+ for(std::vector<cmSourceFile*>::iterator i = classes.begin();
i != classes.end(); i++)
{
- if(!i->IsAHeaderFileOnly())
+ if(!(*i)->IsAHeaderFileOnly())
{
- std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str()));
+ std::string outExt(this->GetOutputExtension((*i)->GetSourceExtension().c_str()));
if(outExt.size())
{
- fout << "\\\n\"" << this->ConvertToOutputPath(i->GetSourceName().c_str())
+ fout << "\\\n\"" << this->ConvertToOutputPath((*i)->GetSourceName().c_str())
<< outExt.c_str() << "\" ";
}
}
@@ -398,7 +398,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
for(cmTargets::const_iterator l = tgts.begin();
l != tgts.end(); l++)
{
- std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
+ std::vector<cmSourceFile*> classes = l->second.GetSourceFiles();
if (classes.begin() != classes.end())
{
fout << "$(" << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS")
@@ -1224,19 +1224,19 @@ bool cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
target != targets.end(); ++target)
{
// Iterate over every source for this target.
- const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
+ const std::vector<cmSourceFile*>& sources = target->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
- if(!source->IsAHeaderFileOnly())
+ if(!(*source)->IsAHeaderFileOnly())
{
- if(!source->GetDepends().empty())
+ if(!(*source)->GetDepends().empty())
{
- fout << source->GetSourceName() << m_ObjectFileExtension << " :";
+ fout << (*source)->GetSourceName() << m_ObjectFileExtension << " :";
// Iterate through all the dependencies for this source.
for(std::vector<std::string>::const_iterator dep =
- source->GetDepends().begin();
- dep != source->GetDepends().end(); ++dep)
+ (*source)->GetDepends().begin();
+ dep != (*source)->GetDepends().end(); ++dep)
{
fout << " \\\n"
<< this->ConvertToOutputPath(dep->c_str());
@@ -1274,17 +1274,17 @@ void cmUnixMakefileGenerator::OutputCheckDepends(std::ostream& fout)
target != targets.end(); ++target)
{
// Iterate over every source for this target.
- const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
+ const std::vector<cmSourceFile*>& sources = target->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
- if(!source->IsAHeaderFileOnly())
+ if(!(*source)->IsAHeaderFileOnly())
{
- if(!source->GetDepends().empty())
+ if(!(*source)->GetDepends().empty())
{
for(std::vector<std::string>::const_iterator dep =
- source->GetDepends().begin();
- dep != source->GetDepends().end(); ++dep)
+ (*source)->GetDepends().begin();
+ dep != (*source)->GetDepends().end(); ++dep)
{
std::string dependfile =
this->ConvertToOutputPath(dep->c_str());
@@ -1702,14 +1702,14 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
target != targets.end(); ++target)
{
// Iterate over every source for this target.
- const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
+ const std::vector<cmSourceFile*>& sources = target->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
- if(!source->IsAHeaderFileOnly())
+ if(!(*source)->IsAHeaderFileOnly())
{
allsources += " \\\n";
- allsources += source->GetFullPath();
+ allsources += (*source)->GetFullPath();
}
}
}
@@ -1810,7 +1810,9 @@ OutputBuildObjectFromSource(std::ostream& fout,
{
// Header files shouldn't have build rules.
if(source.IsAHeaderFileOnly())
+ {
return;
+ }
std::string comment = "Build ";
std::string objectFile = std::string(shortName) + m_ObjectFileExtension;
@@ -1877,11 +1879,11 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
exportsDef = "-D"+target->first+"_EXPORTS ";
}
// Iterate over every source for this target.
- const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
- for(std::vector<cmSourceFile>::const_iterator source = sources.begin();
+ const std::vector<cmSourceFile*>& sources = target->second.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source)
{
- if(!source->IsAHeaderFileOnly())
+ if(!(*source)->IsAHeaderFileOnly())
{
std::string shortName;
std::string sourceName;
@@ -1889,18 +1891,18 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
// directory, we want to use the relative path for the
// filename of the object file. Otherwise, we will use just
// the filename portion.
- if((cmSystemTools::GetFilenamePath(source->GetFullPath()).find(m_Makefile->GetCurrentDirectory()) == 0)
- || (cmSystemTools::GetFilenamePath(source->GetFullPath()).find(m_Makefile->
+ if((cmSystemTools::GetFilenamePath((*source)->GetFullPath()).find(m_Makefile->GetCurrentDirectory()) == 0)
+ || (cmSystemTools::GetFilenamePath((*source)->GetFullPath()).find(m_Makefile->
GetCurrentOutputDirectory()) == 0))
{
- sourceName = source->GetSourceName()+"."+source->GetSourceExtension();
- shortName = source->GetSourceName();
+ sourceName = (*source)->GetSourceName()+"."+(*source)->GetSourceExtension();
+ shortName = (*source)->GetSourceName();
// The path may be relative. See if a directory needs to be
// created for the output file. This is a ugly, and perhaps
// should be moved elsewhere.
std::string relPath =
- cmSystemTools::GetFilenamePath(source->GetSourceName());
+ cmSystemTools::GetFilenamePath((*source)->GetSourceName());
if(relPath != "")
{
std::string outPath = m_Makefile->GetCurrentOutputDirectory();
@@ -1910,22 +1912,22 @@ void cmUnixMakefileGenerator::OutputSourceObjectBuildRules(std::ostream& fout)
}
else
{
- sourceName = source->GetFullPath();
- shortName = cmSystemTools::GetFilenameName(source->GetSourceName());
+ sourceName = (*source)->GetFullPath();
+ shortName = cmSystemTools::GetFilenameName((*source)->GetSourceName());
}
std::string shortNameWithExt = shortName +
- source->GetSourceExtension();
+ (*source)->GetSourceExtension();
// Only output a rule for each .o once.
if(rules.find(shortNameWithExt) == rules.end())
{
- if(source->GetCompileFlags())
+ if((*source)->GetCompileFlags())
{
- exportsDef += source->GetCompileFlags();
+ exportsDef += (*source)->GetCompileFlags();
exportsDef += " ";
}
this->OutputBuildObjectFromSource(fout,
shortName.c_str(),
- *source,
+ *(*source),
exportsDef.c_str(),
shared);
rules.insert(shortNameWithExt);
diff --git a/Source/cmVTKMakeInstantiatorCommand.cxx b/Source/cmVTKMakeInstantiatorCommand.cxx
index 4c69a95..3294bc4 100644
--- a/Source/cmVTKMakeInstantiatorCommand.cxx
+++ b/Source/cmVTKMakeInstantiatorCommand.cxx
@@ -121,20 +121,20 @@ cmVTKMakeInstantiatorCommand
return false;
}
- std::vector<cmSourceFile>& srcList = srcListIter->second;
+ std::vector<cmSourceFile*>& srcList = srcListIter->second;
// Collect the names of the classes.
- for(std::vector<cmSourceFile>::iterator src = srcList.begin();
+ for(std::vector<cmSourceFile*>::iterator src = srcList.begin();
src != srcList.end();++src)
{
// Wrap-excluded and abstract classes do not have a New() method.
// vtkIndent and vtkTimeStamp are special cases and are not
// vtkObject subclasses.
- if(!src->GetWrapExclude() && !src->GetIsAnAbstractClass()
- && (src->GetSourceName() != "vtkIndent")
- && (src->GetSourceName() != "vtkTimeStamp"))
+ if(!(*src)->GetWrapExclude() && !(*src)->GetIsAnAbstractClass()
+ && ((*src)->GetSourceName() != "vtkIndent")
+ && ((*src)->GetSourceName() != "vtkTimeStamp"))
{
- m_Classes.push_back(src->GetSourceName());
+ m_Classes.push_back((*src)->GetSourceName());
}
}
}
diff --git a/Source/cmVTKWrapJavaCommand.cxx b/Source/cmVTKWrapJavaCommand.cxx
index 10c5b9e..49b374e 100644
--- a/Source/cmVTKWrapJavaCommand.cxx
+++ b/Source/cmVTKWrapJavaCommand.cxx
@@ -50,10 +50,10 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("bad source list passed to VTKWrapJavaCommand");
return false;
}
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
{
diff --git a/Source/cmVTKWrapPythonCommand.cxx b/Source/cmVTKWrapPythonCommand.cxx
index e1359f9..ad595e7 100644
--- a/Source/cmVTKWrapPythonCommand.cxx
+++ b/Source/cmVTKWrapPythonCommand.cxx
@@ -51,10 +51,10 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("bad source list passed to VTKWrapPythonCommand");
return false;
}
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
{
diff --git a/Source/cmVTKWrapTclCommand.cxx b/Source/cmVTKWrapTclCommand.cxx
index 4d5e8fc..0f9b524 100644
--- a/Source/cmVTKWrapTclCommand.cxx
+++ b/Source/cmVTKWrapTclCommand.cxx
@@ -82,10 +82,10 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("bad source list passed to VTKWrapTclCommand");
return false;
}
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- cmSourceFile &curr = *i;
+ cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
{
diff --git a/Source/cmWrapExcludeFilesCommand.cxx b/Source/cmWrapExcludeFilesCommand.cxx
index 05a0a1d..153d30e 100644
--- a/Source/cmWrapExcludeFilesCommand.cxx
+++ b/Source/cmWrapExcludeFilesCommand.cxx
@@ -32,12 +32,12 @@ bool cmWrapExcludeFilesCommand::InitialPass(std::vector<std::string> const& args
for(cmMakefile::SourceMap::iterator l = Classes.begin();
l != Classes.end(); l++)
{
- for(std::vector<cmSourceFile>::iterator i = l->second.begin();
+ for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
- if(i->GetSourceName() == (*j))
+ if((*i)->GetSourceName() == (*j))
{
- i->SetWrapExclude(true);
+ (*i)->SetWrapExclude(true);
}
}
}
diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx
index 0227b3d..37a3d98 100644
--- a/Source/cmaketest.cxx
+++ b/Source/cmaketest.cxx
@@ -16,6 +16,7 @@
=========================================================================*/
#include "cmaketest.h"
#include "cmSystemTools.h"
+#include "cmRegularExpression.h"
#include "cmake.h"
#include "cmListFileCache.h"
#include "cmMakefileGenerator.h"
@@ -24,13 +25,14 @@
#endif
// this is a test driver program for cmake.
-int main (int argc, char *argv[])
+int main (int argc, char **argv)
{
if (argc < 4)
{
std::cerr << "Usage: " << argv[0] << " test-src-dir test-bin-dir test-executable\n";
return 1;
}
+
// does the directory exist ?
if (!cmSystemTools::FileIsDirectory(argv[2]))
{
@@ -140,7 +142,11 @@ int main (int argc, char *argv[])
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
std::string lowerCaseCommand = makeCommand;
cmSystemTools::LowerCase(lowerCaseCommand);
-
+ std::string dartMakeCommand = DART_MAKECOMMAND;
+ std::string buildtype = "Debug";
+#ifdef CMAKE_INTDIR
+ buildtype = CMAKE_INTDIR;
+#endif
// if msdev is the make program then do the following
// MSDEV 6.0
if(lowerCaseCommand.find("msdev") != std::string::npos)
@@ -162,7 +168,8 @@ int main (int argc, char *argv[])
#endif
makeCommand += " ";
makeCommand += projectName;
- makeCommand += ".dsw /MAKE \"ALL_BUILD - Debug\" /REBUILD";
+ makeCommand += ".dsw /MAKE \"ALL_BUILD - ";
+ makeCommand += buildtype + "\" /REBUILD";
}
// MSDEV 7.0 .NET
else if (lowerCaseCommand.find("devenv") != std::string::npos)
@@ -181,7 +188,8 @@ int main (int argc, char *argv[])
#endif
makeCommand += " ";
makeCommand += projectName;
- makeCommand += ".sln /rebuild Debug /project ALL_BUILD";
+ makeCommand += ".sln /rebuild ";
+ makeCommand += buildtype + " /project ALL_BUILD";
}
// command line make program
else
@@ -228,7 +236,7 @@ int main (int argc, char *argv[])
fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
}
// try the Debug extension
- tryPath = "Debug/";
+ tryPath = buildtype + "/";
tryPath += cmSystemTools::GetFilenameName(executableName);
if(cmSystemTools::FileExists(tryPath.c_str()))
{
@@ -248,7 +256,8 @@ int main (int argc, char *argv[])
fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str());
}
tryPath = executableDirectory;
- tryPath += "/Debug/";
+ tryPath += "/";
+ tryPath += buildtype + "/";
tryPath += executableName;
tryPath += cmSystemTools::GetExecutableExtension();
if(cmSystemTools::FileExists(tryPath.c_str()))
diff --git a/Source/cmaketest.h.in b/Source/cmaketest.h.in
index 939ea08..61ae7aa 100644
--- a/Source/cmaketest.h.in
+++ b/Source/cmaketest.h.in
@@ -1,3 +1,4 @@
#define CMAKE_COMMAND "${CMAKE_COMMAND}"
#define MAKEPROGRAM "${MAKEPROGRAM}"
#define CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+#define DART_MAKECOMMAND "${MAKECOMMAND}"