removed all source lists from the system and made them vectors. Also appended _CMAKE_PATH to the end of the automatic cache entries for executables and libraries. Odds of all these changes working are slim but cmake builds and passes all its tests. VTK40 starts building

This commit is contained in:
Ken Martin 2002-06-27 15:57:09 -04:00
parent a1a05a5fbc
commit 44a7cd55ff
29 changed files with 452 additions and 426 deletions

View File

@ -26,6 +26,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass(std::vector<std::string> const& ar
return false;
}
std::string sourceListValue;
std::string templateDirectory = args[0];
m_Makefile->AddExtraDirectory(templateDirectory.c_str());
std::string tdir = m_Makefile->GetCurrentDirectory();
@ -61,11 +62,17 @@ bool cmAuxSourceDirectoryCommand::InitialPass(std::vector<std::string> const& ar
m_Makefile->GetSourceExtensions(),
m_Makefile->GetHeaderExtensions());
cmfile.SetIsAnAbstractClass(false);
m_Makefile->AddSource(cmfile,args[1].c_str());
m_Makefile->AddSource(cmfile);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += cmfile.GetSourceName();
}
}
}
}
m_Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str());
return true;
}

View File

@ -266,7 +266,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"cxx",
false);
m_Makefile->AddSource(cfile);
sourceListValue = args[1].c_str();
sourceListValue = args[1] + ".cxx";
for(i = testsBegin; i != tests.end(); ++i)
{

View File

@ -252,8 +252,9 @@ void cmDSWWriter::WriteProject(std::ostream& fout,
if(j->first != dspname)
{
// is the library part of this DSW ? If so add dependency
std::string libPath = j->first + "_CMAKE_PATH";
const char* cacheValue
= m_Makefile->GetDefinition(j->first.c_str());
= m_Makefile->GetDefinition(libPath.c_str());
if(cacheValue)
{
fout << "Begin Project Dependency\n";

View File

@ -48,39 +48,33 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
m_Target = args[0]; // Target that will use the generated files
m_GUISourceList = args[1]; // Source List of the GUI source files
cmMakefile::SourceMap &GUISources = m_Makefile->GetSources();
std::vector<std::string> newArgs;
m_Makefile->ExpandSourceListArguments(args,newArgs, 1);
// get the list of GUI files from which .cxx and .h will be generated
cmMakefile::SourceMap::iterator l = GUISources.find( m_GUISourceList );
if (l == GUISources.end())
{
this->SetError("bad source list passed to FLTKWrapUICommand");
return false;
}
std::string outputDirectory = m_Makefile->GetCurrentOutputDirectory();
// Some of the generated files are *.h so the directory "GUI"
// 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();
i != l->second.end(); i++)
for(std::vector<std::string>::iterator i = (newArgs.begin() + 1);
i != newArgs.end(); i++)
{
cmSourceFile &curr = *(*i);
cmSourceFile *curr = m_Makefile->GetSource(i->c_str());
// if we should use the source GUI
// to generate .cxx and .h files
if (!curr.GetWrapExclude())
if (!curr || !curr->GetWrapExclude())
{
cmSourceFile header_file;
cmSourceFile source_file;
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*i);
const bool headerFileOnly = true;
header_file.SetName(curr.GetSourceName().c_str(),
header_file.SetName(srcName.c_str(),
outputDirectory.c_str(), "h",headerFileOnly);
source_file.SetName(curr.GetSourceName().c_str(),
source_file.SetName(srcName.c_str(),
outputDirectory.c_str(), "cxx",!headerFileOnly);
std::string origname = cdir + "/" + curr.GetSourceName() + "." +
curr.GetSourceExtension();
std::string origname = cdir + "/" + *i;
std::string hname = header_file.GetFullPath();
std::string cxxname = source_file.GetFullPath();
m_WrapUserInterface.push_back(origname);
@ -90,7 +84,6 @@ bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
header_file.GetDepends().push_back(origname);
m_GeneratedHeadersClasses.push_back(header_file);
m_GeneratedSourcesClasses.push_back(source_file);
}
}

View File

@ -54,7 +54,7 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
}
else if (args[2] == "NAME_WE")
{
result = cmSystemTools::GetFilenameNameWithoutExtension(filename);
result = cmSystemTools::GetFilenameWithoutExtension(filename);
}
else
{

View File

@ -58,7 +58,7 @@ bool cmITKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
bool cmITKWrapTclCommand::CreateCableRule(const char* configFile)
{
std::string tclFile =
cmSystemTools::GetFilenameNameWithoutExtension(configFile);
cmSystemTools::GetFilenameWithoutExtension(configFile);
tclFile += "_tcl";
std::string inFile = m_Makefile->GetCurrentDirectory();
@ -138,8 +138,10 @@ bool cmITKWrapTclCommand::CreateCableRule(const char* configFile)
// Set dependency hints.
file.GetDepends().push_back(inFile.c_str());
file.GetDepends().push_back("CableTclFacility/ctCalls.h");
m_Makefile->AddSource(file, m_TargetName.c_str());
m_Makefile->AddSource(file);
std::string srcname = file.GetSourceName() + ".cxx";
m_Makefile->AddDefinition(m_TargetName.c_str(),
srcname.c_str());
return true;
}

View File

@ -26,7 +26,7 @@ bool cmInstallFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
// Create an INSTALL_FILES target specifically for this path.
m_TargetName = "INSTALL_FILES_"+args[0];
@ -63,26 +63,9 @@ void cmInstallFilesCommand::FinalPass()
{
// replace any variables
std::string temps = *s;
// look for a srclist
if (m_Makefile->GetSources().find(temps) != m_Makefile->GetSources().end())
{
const std::vector<cmSourceFile*> &clsList =
m_Makefile->GetSources().find(temps)->second;
std::vector<cmSourceFile*>::const_iterator c = clsList.begin();
for (; c != clsList.end(); ++c)
{
testf = (*c)->GetSourceName() + ext;
// add to the result
targetSourceLists.push_back(testf);
}
}
// if one wasn't found then assume it is a single class
else
{
testf = temps + ext;
// add to the result
targetSourceLists.push_back(testf);
}
testf = temps + ext;
// add to the result
targetSourceLists.push_back(testf);
}
}
else // reg exp list

View File

@ -51,7 +51,8 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& argsIn)
const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
if (cmSystemTools::IsOff(ldir))
{
const char* dir = m_Makefile->GetDefinition(i->c_str());
std::string libPath = *i + "_CMAKE_PATH";
const char* dir = m_Makefile->GetDefinition(libPath.c_str());
if( dir )
{
m_Makefile->AddLinkDirectory( dir );

View File

@ -407,8 +407,9 @@ void cmMSDotNETGenerator::WriteProjectDepends(std::ostream& fout,
if(j->first != dspname)
{
// is the library part of this SLN ? If so add dependency
std::string libPath = j->first + "_CMAKE_PATH";
const char* cacheValue
= m_Makefile->GetDefinition(j->first.c_str());
= m_Makefile->GetDefinition(libPath.c_str());
if(cacheValue)
{
fout << "\t\t{" << this->CreateGUID(dspname) << "}." << depcount << " = {"

View File

@ -143,33 +143,29 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
if(!found)
{
// Try to find the file amongst the sources
cmMakefile::SourceMap srcmap = m_Makefile->GetSources();
cmMakefile::SourceMap::iterator l;
for (l= srcmap.begin() ; l!=srcmap.end() ; l++)
cmSourceFile *srcFile =
m_Makefile->GetSource(cmSystemTools::GetFilenameWithoutExtension(path).c_str());
if (srcFile)
{
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
if (srcFile->GetFullPath() == path)
{
if ((*i)->GetFullPath() == path)
{
found=true;
}
else
{
//try to guess which include path to use
for(std::vector<std::string>::iterator t =
found=true;
}
else
{
//try to guess which include path to use
for(std::vector<std::string>::iterator t =
m_IncludeDirectories.begin();
t != m_IncludeDirectories.end(); ++t)
t != m_IncludeDirectories.end(); ++t)
{
std::string incpath = *t;
incpath = incpath + "/";
incpath = incpath + path;
if (srcFile->GetFullPath() == incpath)
{
std::string incpath = *t;
incpath = incpath + "/";
incpath = incpath + path;
if ((*i)->GetFullPath() == incpath)
{
// set the path to the guessed path
info->m_FullPath = incpath;
found=true;
}
// set the path to the guessed path
info->m_FullPath = incpath;
found=true;
}
}
}

View File

@ -154,16 +154,6 @@ void cmMakefile::Print() const
{
// print the class lists
std::cout << "classes:\n";
for(SourceMap::const_iterator l = m_Sources.begin();
l != m_Sources.end(); l++)
{
std::cout << " Class list named: " << l->first << std::endl;
for(std::vector<cmSourceFile*>::const_iterator i = l->second.begin();
i != l->second.end(); i++)
{
(*i)->Print();
}
}
std::cout << " m_Targets: ";
for (cmTargets::const_iterator l = m_Targets.begin();
@ -365,27 +355,6 @@ bool cmMakefile::ReadListFile(const char* filename, const char* external)
}
cmSourceFile *cmMakefile::GetSource(const char *srclist, const char *cname)
{
SourceMap::iterator sl = m_Sources.find(srclist);
// find the src list
if (sl == m_Sources.end())
{
return 0;
}
// find the class
for (std::vector<cmSourceFile*>::iterator i = sl->second.begin();
i != sl->second.end(); ++i)
{
if ((*i)->GetSourceName() == cname)
{
return *i;
}
}
return 0;
}
void cmMakefile::AddCommand(cmCommand* wg)
{
std::string name = wg->GetName();
@ -444,26 +413,6 @@ void cmMakefile::GenerateMakefile()
}
void cmMakefile::AddSource(cmSourceFile& cmfile, const char *srclist)
{
m_Sources[srclist].push_back(this->AddSource(cmfile));
}
void cmMakefile::RemoveSource(cmSourceFile& cmfile, const char *srclist)
{
std::vector<cmSourceFile*> &maplist = m_Sources[srclist];
for( std::vector<cmSourceFile*>::iterator f = maplist.begin();
f != maplist.end(); ++f)
{
if((*f)->GetSourceName() == cmfile.GetSourceName())
{
maplist.erase(f);
return;
}
}
}
void cmMakefile::AddCustomCommand(const char* source,
const char* command,
const std::vector<std::string>& commandArgs,
@ -711,8 +660,10 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
m_Targets.insert(cmTargets::value_type(lname,target));
// Add an entry into the cache
std::string libPath = lname;
libPath += "_CMAKE_PATH";
cmCacheManager::GetInstance()->
AddCacheEntry(lname,
AddCacheEntry(libPath.c_str(),
this->GetCurrentOutputDirectory(),
"Path to a library", cmCacheManager::INTERNAL);
@ -778,8 +729,10 @@ void cmMakefile::AddExecutable(const char *exeName,
// Add an entry into the cache
std::string exePath = exeName;
exePath += "_CMAKE_PATH";
cmCacheManager::GetInstance()->
AddCacheEntry(exeName,
AddCacheEntry(exePath.c_str(),
this->GetCurrentOutputDirectory(),
"Path to an executable", cmCacheManager::INTERNAL);
}
@ -1368,7 +1321,7 @@ cmData* cmMakefile::LookupData(const char* name) const
}
}
cmSourceFile* cmMakefile::GetSource(const char* sourceName)
cmSourceFile* cmMakefile::GetSource(const char* sourceName) const
{
std::string s = sourceName;
std::string ext;
@ -1378,7 +1331,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName)
ext = s.substr(pos+1, s.size() - pos-1);
s = s.substr(0, pos);
}
for(std::vector<cmSourceFile*>::iterator i = m_SourceFiles.begin();
for(std::vector<cmSourceFile*>::const_iterator i = m_SourceFiles.begin();
i != m_SourceFiles.end(); ++i)
{
if((*i)->GetSourceName() == s
@ -1411,3 +1364,34 @@ void cmMakefile::EnableLanguage(const char* lang)
m_MakefileGenerator->EnableLanguage(lang);
}
void cmMakefile::ExpandSourceListArguments(
std::vector<std::string> const& arguments,
std::vector<std::string>& newargs, int start)
{
// first figure out if we need to handle version 1.2 style source lists
int oldVersion = 1;
const char* versionValue
= this->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (versionValue && atof(versionValue) > 1.2)
{
oldVersion = 0;
}
// now expand the args
std::vector<std::string> tmpArgs;
int i;
for(i = 0; i < arguments.size(); ++i)
{
// is the arg defined ?, if so use the def
const char *def = this->GetDefinition(arguments[i].c_str());
if (def && oldVersion && i >= start)
{
tmpArgs.push_back(def);
}
else
{
tmpArgs.push_back(arguments[i]);
}
}
cmSystemTools::ExpandListArguments(tmpArgs, newargs);
}

View File

@ -218,12 +218,12 @@ public:
/**
* Add a class/source file to the build.
*/
void AddSource(cmSourceFile& ,const char *srcListName);
//void AddSource(cmSourceFile& ,const char *srcListName);
/**
* Remove a class/source file from the build.
*/
void RemoveSource(cmSourceFile& ,const char *srcListName);
//void RemoveSource(cmSourceFile& ,const char *srcListName);
/**
* Add a source group for consideration when adding a new source.
@ -375,18 +375,21 @@ public:
return m_IncludeDirectories;
}
/**
* Return a list of source files in this makefile.
/** Expand out any arguements in the vector that have ; separated
* strings into multiple arguements. A new vector is created
* containing the expanded versions of all arguments in argsIn.
* This method differes from the one in cmSystemTools in that if
* the CmakeLists file is version 1.2 or earlier it will check for
* source lists being used without ${} around them
*/
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);
void ExpandSourceListArguments(std::vector<std::string> const& argsIn,
std::vector<std::string>& argsOut,
int startArgumentIndex);
/** 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);
cmSourceFile* GetSource(const char* sourceName) const;
///! Add a new cmSourceFile to the list of sources for this makefile.
cmSourceFile* AddSource(cmSourceFile const&);
@ -524,10 +527,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>
{

View File

@ -25,7 +25,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
@ -50,37 +50,28 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn)
m_SourceList = args[1];
// get the list of classes for this library
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
for(std::vector<std::string>::iterator j = (args.begin() + 2);
j != args.end(); ++j)
{
cmMakefile::SourceMap::iterator l = Classes.find(*j);
if (l == Classes.end())
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
this->SetError("bad source list passed to QTWrapCPPCommand");
return false;
}
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
cmSourceFile file;
if (curr)
{
cmSourceFile file;
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = "moc_" + curr.GetSourceName();
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + curr.GetSourceName() + "." +
curr.GetSourceExtension();
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = "moc_" + srcName;
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + *j;
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
}
}
@ -94,7 +85,14 @@ void cmQTWrapCPPCommand::FinalPass()
size_t lastClass = m_WrapClasses.size();
std::vector<std::string> depends;
std::string moc_exe = "${QT_MOC_EXE}";
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// wrap all the .h files
depends.push_back(moc_exe);
@ -110,7 +108,12 @@ void cmQTWrapCPPCommand::FinalPass()
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
// Add output to build list
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
m_Makefile->AddSource(m_WrapClasses[classNum]);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
// set up moc command
std::string res = m_Makefile->GetCurrentOutputDirectory();
@ -131,7 +134,7 @@ void cmQTWrapCPPCommand::FinalPass()
}
m_Makefile->AddDefinition("GENERATED_QT_FILES",moc_list.c_str());
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}

View File

@ -25,7 +25,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 3);
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
@ -49,63 +49,66 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn)
m_LibraryName = args[0];
m_HeaderList = args[1];
m_SourceList = args[2];
std::string sourceListValue;
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// get the list of classes for this library
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::const_iterator j = (args.begin() + 3);
for(std::vector<std::string>::iterator j = (args.begin() + 3);
j != args.end(); ++j)
{
cmMakefile::SourceMap::iterator l = Classes.find(*j);
if (l == Classes.end())
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
this->SetError("bad source list passed to QTWrapUICommand");
return false;
}
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
cmSourceFile header_file;
cmSourceFile source_file;
cmSourceFile moc_file;
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
header_file.SetName(srcName.c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"h",false);
source_file.SetName(srcName.c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string moc_source_name("moc_");
moc_source_name = moc_source_name + srcName;
moc_file.SetName(moc_source_name.c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string origname = cdir + "/" + *j;
std::string hname = header_file.GetFullPath();
m_WrapUserInterface.push_back(origname);
// add starting depends
moc_file.GetDepends().push_back(hname);
source_file.GetDepends().push_back(hname);
source_file.GetDepends().push_back(origname);
header_file.GetDepends().push_back(origname);
m_WrapHeadersClasses.push_back(header_file);
m_WrapSourcesClasses.push_back(source_file);
m_WrapMocClasses.push_back(moc_file);
m_Makefile->AddSource(header_file);
m_Makefile->AddSource(source_file);
m_Makefile->AddSource(moc_file);
// create the list of sources
if (sourceListValue.size() > 0)
{
cmSourceFile header_file;
cmSourceFile source_file;
cmSourceFile moc_file;
header_file.SetName(curr.GetSourceName().c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"h",false);
source_file.SetName(curr.GetSourceName().c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string moc_source_name("moc_");
moc_source_name = moc_source_name + curr.GetSourceName().c_str();
moc_file.SetName(moc_source_name.c_str(),
m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string origname = cdir + "/" + curr.GetSourceName() + "." +
curr.GetSourceExtension();
std::string hname = header_file.GetFullPath();
m_WrapUserInterface.push_back(origname);
// add starting depends
moc_file.GetDepends().push_back(hname);
source_file.GetDepends().push_back(hname);
source_file.GetDepends().push_back(origname);
header_file.GetDepends().push_back(origname);
m_WrapHeadersClasses.push_back(header_file);
m_WrapSourcesClasses.push_back(source_file);
m_WrapMocClasses.push_back(moc_file);
m_Makefile->AddSource(header_file,
m_HeaderList.c_str());
m_Makefile->AddSource(source_file,
m_SourceList.c_str());
m_Makefile->AddSource(moc_file,
m_SourceList.c_str());
sourceListValue += ";";
}
sourceListValue += header_file.GetSourceName() + ".h";
sourceListValue += ";";
sourceListValue += source_file.GetSourceName() + ".cxx";
sourceListValue += ";";
sourceListValue += moc_file.GetSourceName() + ".cxx";
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
return true;
}

View File

@ -34,8 +34,16 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
std::string sourceListValue;
// was the list already populated
std::string name = args[0];
const char *def = m_Makefile->GetDefinition(name.c_str());
if (def)
{
sourceListValue = def;
}
int generated = 0;
@ -54,8 +62,12 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
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);
// then add the pointer to the source list without creating cmSourceFile
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += copy;
continue;
}
cmSourceFile file;
@ -79,11 +91,13 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
}
else
{
file.SetName(name_no_ext.c_str(), m_Makefile->GetCurrentOutputDirectory(),
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] == ':'))
@ -99,9 +113,16 @@ bool cmSourceFilesCommand::InitialPass(std::vector<std::string> const& argsIn)
m_Makefile->GetSourceExtensions(),
m_Makefile->GetHeaderExtensions());
}
m_Makefile->AddSource(file, name.c_str());
}
m_Makefile->AddSource(file);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += copy;
}
m_Makefile->AddDefinition(name.c_str(), sourceListValue.c_str());
return true;
}

View File

@ -17,7 +17,7 @@
#include "cmSourceFilesRemoveCommand.h"
// cmSourceFilesRemoveCommand
bool cmSourceFilesRemoveCommand::InitialPass(std::vector<std::string> const& argsIn)
bool cmSourceFilesRemoveCommand::InitialPass(std::vector<std::string> const& args)
{
const char* versionValue
= m_Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
@ -26,56 +26,60 @@ bool cmSourceFilesRemoveCommand::InitialPass(std::vector<std::string> const& arg
this->SetError("The SOURCE_FILES_REMOVE command has been deprecated in CMake version 1.4. You should use the REMOVE command instead.\n");
return false;
}
if(argsIn.size() < 1 )
if(args.size() < 2 )
{
this->SetError("called with incorrect number of arguments");
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
int generated = 0;
for(std::vector<std::string>::const_iterator i = (args.begin() + 1);
i != args.end(); ++i)
const char* variable = args[0].c_str(); // VAR is always first
// get the old value
const char* cacheValue
= m_Makefile->GetDefinition(variable);
// expand the variable
std::vector<std::string> varArgsExpanded;
std::vector<std::string> temp;
temp.push_back(std::string(cacheValue));
cmSystemTools::ExpandListArguments(temp, varArgsExpanded);
// expand the args
// check for REMOVE(VAR v1 v2 ... vn)
std::vector<std::string> argsExpanded;
std::vector<std::string> temp2;
for(unsigned int j = 1; j < args.size(); ++j)
{
std::string copy = *i;
if ( copy == "GENERATED" )
{
generated = 1;
continue;
}
cmSourceFile file;
if ( generated )
{
// This file will be generated, so we should not check
// if it exist.
std::string ext = cmSystemTools::GetFilenameExtension(copy);
std::string path = cmSystemTools::GetFilenamePath(copy);
std::string name_no_ext = cmSystemTools::GetFilenameName(copy.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
{
file.SetName((*i).c_str(), m_Makefile->GetCurrentDirectory(),
m_Makefile->GetSourceExtensions(),
m_Makefile->GetHeaderExtensions());
}
m_Makefile->RemoveSource(file, args[0].c_str());
temp2.push_back(args[j]);
}
cmSystemTools::ExpandListArguments(temp2, argsExpanded);
// now create the new value
std::string value;
for(unsigned int j = 0; j < varArgsExpanded.size(); ++j)
{
int found = 0;
for(unsigned int k = 0; k < argsExpanded.size(); ++k)
{
if (varArgsExpanded[j] == argsExpanded[k])
{
found = 1;
break;
}
}
if (!found)
{
if (value.size())
{
value += ";";
}
value += varArgsExpanded[j];
}
}
// add the definition
m_Makefile->AddDefinition(variable, value.c_str());
return true;
}

View File

@ -1865,7 +1865,7 @@ std::string cmSystemTools::GetFilenameExtension(const std::string& filename)
* Return file name without extension of a full filename (i.e. without path).
* Warning: it considers the longest extension (for example: .tar.gz)
*/
std::string cmSystemTools::GetFilenameNameWithoutExtension(const std::string& filename)
std::string cmSystemTools::GetFilenameWithoutExtension(const std::string& filename)
{
std::string name = cmSystemTools::GetFilenameName(filename);
std::string::size_type dot_pos = name.find(".");

View File

@ -253,7 +253,7 @@ public:
static std::string GetFilenameExtension(const std::string&);
///! return file name without extension of a full filename.
static std::string GetFilenameNameWithoutExtension(const std::string&);
static std::string GetFilenameWithoutExtension(const std::string&);
static long int ModifiedTime(const char* filename);

View File

@ -39,19 +39,6 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
std::string temps = *s;
mf.ExpandVariablesInString(temps);
// look for a srclist, this is old code we really don't want
// any source lists in the future.
if (mf.GetSources().find(temps) != mf.GetSources().end())
{
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(),
clsList.begin(),
clsList.end());
done = 1;
}
// Next if one wasn't found then assume it is a single class
if (!done && mf.GetSource(temps.c_str()))
{
@ -64,25 +51,16 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
// where a source list would be passed into here, by making it
// a vector we need to possibly lookup the variable to maintain
// CMake 1.2 compatability.
const char* versionValue
= mf.GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (!done)
{
const char* versionValue
= mf.GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
if (!versionValue || atof(versionValue) <= 1.2)
{
const char* varValue =
mf.GetDefinition(temps.c_str());
// if the definition exists
// and it has an extension in it then assume it is a source file
// the problem is that ADD_EXECUTABLE creates a definition with the
// same name as the executable which could be the same name as the
// source file without the extension, so if you do this:
// ADD_EXECUTABLE(foo foo) where foo.cxx is a source file, then
// foo will be varValue will be defined to the path of the executable, but
// not a source list as we expect, so look for a "." in the string to see
// if it is a file or not.
if (varValue
&& strchr(varValue, '.'))
if (varValue)
{
std::vector<std::string> tval;
tval.push_back(varValue);
@ -340,7 +318,10 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf )
{
if( addLibDirs )
{
const char* libpath = mf.GetDefinition( k->c_str() );
// who the hell knows what this is, I think that K contains the
// name of a library but ... Ken
std::string libPathStr = *k + "_CMAKE_PATH";
const char* libpath = mf.GetDefinition( libPathStr.c_str() );
if( libpath )
{
// Don't add a link directory that is already present.

View File

@ -54,7 +54,8 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string> const& a
const char* ldir = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
if (cmSystemTools::IsOff(ldir))
{
const char* dir = m_Makefile->GetDefinition(i->c_str());
std::string libPath = *i + "_CMAKE_PATH";
const char* dir = m_Makefile->GetDefinition(libPath.c_str());
if( dir )
{
m_Makefile->AddLinkDirectoryForTarget(args[0].c_str(), dir );

View File

@ -942,7 +942,8 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout)
// loop over the list of directories that the libraries might
// be in, looking for an ADD_LIBRARY(lib...) line. This would
// be stored in the cache
const char* cacheValue = m_Makefile->GetDefinition(lib->c_str());
std::string libPath = *lib + "_CMAKE_PATH";
const char* cacheValue = m_Makefile->GetDefinition(libPath.c_str());
// if cache and not the current directory add a rule, to
// jump into the directory and build for the first time
if(cacheValue &&
@ -1058,7 +1059,9 @@ bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2)
void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
const char* name)
{
const char* cacheValue = m_Makefile->GetDefinition(name);
std::string libPath = name;
libPath += "_CMAKE_PATH";
const char* cacheValue = m_Makefile->GetDefinition(libPath.c_str());
if(cacheValue )
{
// if there is a cache value, then this is a library that cmake
@ -1112,7 +1115,9 @@ void cmUnixMakefileGenerator::OutputLibDepend(std::ostream& fout,
void cmUnixMakefileGenerator::OutputExeDepend(std::ostream& fout,
const char* name)
{
const char* cacheValue = m_Makefile->GetDefinition(name);
std::string exePath = name;
exePath += "_CMAKE_PATH";
const char* cacheValue = m_Makefile->GetDefinition(exePath.c_str());
if(cacheValue )
{
// if there is a cache value, then this is a executable/utility that cmake

View File

@ -28,12 +28,11 @@ cmVTKMakeInstantiatorCommand
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
std::string sourceListValue;
m_ClassName = args[0];
std::string outSourceList = args[1];
std::vector<cmStdString> inSourceLists;
m_ExportMacro = "-";
unsigned int groupSize = 10;
@ -112,32 +111,17 @@ cmVTKMakeInstantiatorCommand
for(std::vector<cmStdString>::const_iterator s = inSourceLists.begin();
s != inSourceLists.end(); ++s)
{
// Find the source list specified.
cmMakefile::SourceMap::iterator srcListIter =
m_Makefile->GetSources().find(*s);
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*s);
cmSourceFile *sf = m_Makefile->GetSource(s->c_str());
if(srcListIter == m_Makefile->GetSources().end())
// Wrap-excluded and abstract classes do not have a New() method.
// vtkIndent and vtkTimeStamp are special cases and are not
// vtkObject subclasses.
if(
(!sf || (!sf->GetWrapExclude() && !sf->GetIsAnAbstractClass())) &&
((srcName != "vtkIndent") && (srcName != "vtkTimeStamp")))
{
std::string errStr = "No source list named " + *s;
this->SetError(errStr.c_str());
return false;
}
std::vector<cmSourceFile*>& srcList = srcListIter->second;
// Collect the names of the classes.
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"))
{
m_Classes.push_back((*src)->GetSourceName());
}
m_Classes.push_back(srcName);
}
}
@ -173,7 +157,8 @@ cmVTKMakeInstantiatorCommand
file.SetName(fileName.c_str(), filePath.c_str(),
m_Makefile->GetSourceExtensions(),
m_Makefile->GetHeaderExtensions());
m_Makefile->AddSource(file, outSourceList.c_str());
m_Makefile->AddSource(file);
sourceListValue += file.GetSourceName() + ".cxx";
}
size_t numClasses = m_Classes.size();
@ -207,9 +192,12 @@ cmVTKMakeInstantiatorCommand
file.SetName(fileName.c_str(), filePath.c_str(),
m_Makefile->GetSourceExtensions(),
m_Makefile->GetHeaderExtensions());
m_Makefile->AddSource(file, outSourceList.c_str());
m_Makefile->AddSource(file);
sourceListValue += ";";
sourceListValue += file.GetSourceName() + ".cxx";
}
m_Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str());
return true;
}

View File

@ -25,7 +25,7 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
@ -42,35 +42,29 @@ bool cmVTKWrapJavaCommand::InitialPass(std::vector<std::string> const& argsIn)
m_SourceList = args[1];
// get the list of classes for this library
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
j != args.end(); ++j)
{
cmMakefile::SourceMap::iterator l = Classes.find(*j);
if (l == Classes.end())
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
this->SetError("bad source list passed to VTKWrapJavaCommand");
return false;
}
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
cmSourceFile file;
if (curr)
{
cmSourceFile file;
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = curr.GetSourceName() + "Java";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
m_OriginalNames.push_back(curr.GetSourceName());
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Java";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + srcName + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
m_OriginalNames.push_back(srcName);
}
}
@ -89,9 +83,17 @@ void cmVTKWrapJavaCommand::FinalPass()
std::string pjava = "${VTK_PARSE_JAVA_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
std::string resultDirectory = "${VTK_JAVA_HOME}";
std::string sourceListValue;
m_Makefile->ExpandVariablesInString(hints);
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
}
// wrap all the .h files
depends.push_back(wjava);
depends2.push_back(pjava);
@ -102,7 +104,12 @@ void cmVTKWrapJavaCommand::FinalPass()
}
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
m_Makefile->AddSource(m_WrapClasses[classNum]);
if (sourceListValue.size() > 0)
{
sourceListValue += ";";
}
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
// wrap java
std::string res = m_Makefile->GetCurrentOutputDirectory();
@ -146,6 +153,7 @@ void cmVTKWrapJavaCommand::FinalPass()
alldepends,
empty);
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}

View File

@ -25,7 +25,7 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
@ -43,34 +43,28 @@ bool cmVTKWrapPythonCommand::InitialPass(std::vector<std::string> const& argsIn)
m_SourceList = args[1];
// get the list of classes for this library
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::const_iterator j = (args.begin() + 2);
for(std::vector<std::string>::iterator j = (args.begin() + 2);
j != args.end(); ++j)
{
cmMakefile::SourceMap::iterator l = Classes.find(*j);
if (l == Classes.end())
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
this->SetError("bad source list passed to VTKWrapPythonCommand");
return false;
}
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
{
cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
cmSourceFile file;
if (curr)
{
cmSourceFile file;
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = curr.GetSourceName() + "Python";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Python";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + srcName + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
}
}
@ -84,9 +78,18 @@ void cmVTKWrapPythonCommand::FinalPass()
std::vector<std::string> depends;
std::string wpython = "${VTK_WRAP_PYTHON_EXE}";
std::string hints = "${VTK_WRAP_HINTS}";
std::string sourceListValue;
m_Makefile->ExpandVariablesInString(hints);
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
sourceListValue += ";";
}
// Create the init file
std::string res = m_LibraryName;
res += "Init.cxx";
@ -99,7 +102,8 @@ void cmVTKWrapPythonCommand::FinalPass()
newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_Makefile->AddSource(cfile,m_SourceList.c_str());
m_Makefile->AddSource(cfile);
sourceListValue += newName + ".cxx";
// wrap all the .h files
depends.push_back(wpython);
@ -109,7 +113,7 @@ void cmVTKWrapPythonCommand::FinalPass()
}
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
m_Makefile->AddSource(m_WrapClasses[classNum]);
std::string res = m_Makefile->GetCurrentOutputDirectory();
res += "/";
res += m_WrapClasses[classNum].GetSourceName() + ".cxx";
@ -121,11 +125,14 @@ void cmVTKWrapPythonCommand::FinalPass()
}
args.push_back((m_WrapClasses[classNum].IsAnAbstractClass() ? "0" : "1"));
args.push_back(res);
sourceListValue += ";";
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
wpython.c_str(), args, depends,
res.c_str(), m_LibraryName.c_str());
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}
bool cmVTKWrapPythonCommand::CreateInitFile(std::string& res)

View File

@ -25,9 +25,18 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
// keep the library name
m_LibraryName = args[0];
m_LibraryName = argsIn[0];
if (argsIn[1] == std::string("SOURCES"))
{
m_Makefile->ExpandSourceListArguments(argsIn, args, 3);
}
else
{
m_Makefile->ExpandSourceListArguments(argsIn, args, 2);
}
// Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program
@ -73,34 +82,28 @@ bool cmVTKWrapTclCommand::InitialPass(std::vector<std::string> const& argsIn)
// get the resulting source list name
m_SourceList = sources[0];
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
for(std::vector<std::string>::iterator j = (sources.begin() + 1);
j != sources.end(); ++j)
{
cmMakefile::SourceMap::iterator l = Classes.find(*j);
if (l == Classes.end())
{
this->SetError("bad source list passed to VTKWrapTclCommand");
return false;
}
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
cmSourceFile *curr = m_Makefile->GetSource(j->c_str());
// if we should wrap the class
if (!curr || !curr->GetWrapExclude())
{
cmSourceFile &curr = *(*i);
// if we should wrap the class
if (!curr.GetWrapExclude())
cmSourceFile file;
if (curr)
{
cmSourceFile file;
file.SetIsAnAbstractClass(curr.IsAnAbstractClass());
std::string newName = curr.GetSourceName() + "Tcl";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
std::string hname = cdir + "/" + curr.GetSourceName() + ".h";
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
file.SetIsAnAbstractClass(curr->IsAnAbstractClass());
}
std::string srcName = cmSystemTools::GetFilenameWithoutExtension(*j);
std::string newName = srcName + "Tcl";
std::string hname = cdir + "/" + srcName + ".h";
file.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_WrapHeaders.push_back(hname);
// add starting depends
file.GetDepends().push_back(hname);
m_WrapClasses.push_back(file);
}
}
}
@ -117,6 +120,15 @@ void cmVTKWrapTclCommand::FinalPass()
std::string hints = "${VTK_WRAP_HINTS}";
m_Makefile->ExpandVariablesInString(hints);
std::string sourceListValue;
// was the list already populated
const char *def = m_Makefile->GetDefinition(m_SourceList.c_str());
if (def)
{
sourceListValue = def;
sourceListValue += ";";
}
// Create the init file
std::string res = m_LibraryName;
@ -130,7 +142,8 @@ void cmVTKWrapTclCommand::FinalPass()
newName += "Init";
cfile.SetName(newName.c_str(), m_Makefile->GetCurrentOutputDirectory(),
"cxx",false);
m_Makefile->AddSource(cfile,m_SourceList.c_str());
m_Makefile->AddSource(cfile);
sourceListValue += newName + ".cxx";
// wrap all the .h files
depends.push_back(wtcl);
@ -140,7 +153,7 @@ void cmVTKWrapTclCommand::FinalPass()
}
for(size_t classNum = 0; classNum < lastClass; classNum++)
{
m_Makefile->AddSource(m_WrapClasses[classNum],m_SourceList.c_str());
m_Makefile->AddSource(m_WrapClasses[classNum]);
std::vector<std::string> args;
args.push_back(m_WrapHeaders[classNum]);
if (strcmp("${VTK_WRAP_HINTS}",hints.c_str()))
@ -152,12 +165,15 @@ void cmVTKWrapTclCommand::FinalPass()
res += "/";
res += m_WrapClasses[classNum].GetSourceName() + ".cxx";
args.push_back(res);
sourceListValue += ";";
sourceListValue += m_WrapClasses[classNum].GetSourceName() + ".cxx";
m_Makefile->AddCustomCommand(m_WrapHeaders[classNum].c_str(),
wtcl.c_str(), args, depends,
res.c_str(), m_LibraryName.c_str());
}
}
m_Makefile->AddDefinition(m_SourceList.c_str(), sourceListValue.c_str());
}
bool cmVTKWrapTclCommand::CreateInitFile(std::string& res)

View File

@ -33,22 +33,42 @@ bool cmWrapExcludeFilesCommand::InitialPass(std::vector<std::string> const& args
return false;
}
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(argsIn, args);
cmMakefile::SourceMap &Classes = m_Makefile->GetSources();
m_Makefile->ExpandSourceListArguments(argsIn, args, 0);
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++)
// if the file is already in the makefile just set properites on it
cmSourceFile* sf = m_Makefile->GetSource(j->c_str());
if(sf)
{
for(std::vector<cmSourceFile*>::iterator i = l->second.begin();
i != l->second.end(); i++)
sf->SetWrapExclude(true);
}
// 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.SetWrapExclude(true);
// if this is a full path then
if((path.size() && path[0] == '/') ||
(path.size() > 1 && path[1] == ':'))
{
if((*i)->GetSourceName() == (*j))
{
(*i)->SetWrapExclude(true);
}
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;

View File

@ -18,7 +18,7 @@ SOURCE_FILES(LibrarySources
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)
ADD_LIBRARY(CMakeTestLibrary ${LibrarySources})
IF(WIN32)
IF(NOT CYGWIN)
@ -37,7 +37,7 @@ ENDIF(WIN32)
# Create shared library
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)

View File

@ -18,7 +18,7 @@ SOURCE_FILES(LibrarySources
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)
ADD_LIBRARY(CMakeTestLibrary ${LibrarySources})
IF(WIN32)
IF(NOT CYGWIN)
@ -37,7 +37,7 @@ ENDIF(WIN32)
# Create shared library
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)

View File

@ -18,7 +18,7 @@ SOURCE_FILES(LibrarySources
GENERATED
nonexisting_file)
SOURCE_FILES_REMOVE(LibrarySources create_file.cxx GENERATED nonexisting_file)
ADD_LIBRARY(CMakeTestLibrary LibrarySources)
ADD_LIBRARY(CMakeTestLibrary ${LibrarySources})
IF(WIN32)
IF(NOT CYGWIN)
@ -37,7 +37,7 @@ ENDIF(WIN32)
# Create shared library
#
SOURCE_FILES(SharedLibrarySources sharedFile)
ADD_LIBRARY(CMakeTestLibraryShared SHARED SharedLibrarySources)
ADD_LIBRARY(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
ADD_LIBRARY(CMakeTestCLibraryShared SHARED testConly.c)