[Cmake-commits] [cmake-commits] alex committed cmExtraCodeBlocksGenerator.cxx 1.21 1.22
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Mar 10 17:34:22 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv27534
Modified Files:
cmExtraCodeBlocksGenerator.cxx
Log Message:
ENH: only check for the existance of a header file if:
-the original file is a C/C++ implementation file
-the header file is not already part of the sources
Alex
Index: cmExtraCodeBlocksGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExtraCodeBlocksGenerator.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -C 2 -d -r1.21 -r1.22
*** cmExtraCodeBlocksGenerator.cxx 8 Mar 2009 19:33:58 -0000 1.21
--- cmExtraCodeBlocksGenerator.cxx 10 Mar 2009 21:34:18 -0000 1.22
***************
*** 231,235 ****
// Collect all used source files in the project
! std::map<std::string, std::string> sourceFiles;
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++)
--- 231,238 ----
// Collect all used source files in the project
! // Sort them into two containers, one for C/C++ implementation files
! // which may have an acompanying header, one for all other files
! std::map<std::string, cmSourceFile*> cFiles;
! std::set<std::string> otherFiles;
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++)
***************
*** 251,255 ****
si!=sources.end(); si++)
{
! sourceFiles[(*si)->GetFullPath()] = ti->first;
}
}
--- 254,283 ----
si!=sources.end(); si++)
{
! // check whether it is a C/C++ implementation file
! bool isCFile = false;
! if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C'))
! {
! for(std::vector<std::string>::const_iterator
! ext = mf->GetSourceExtensions().begin();
! ext != mf->GetSourceExtensions().end();
! ++ext)
! {
! if ((*si)->GetExtension() == *ext)
! {
! isCFile = true;
! break;
! }
! }
! }
!
! // then put it accordingly into one of the two containers
! if (isCFile)
! {
! cFiles[(*si)->GetFullPath()] = *si ;
! }
! else
! {
! otherFiles.insert((*si)->GetFullPath());
! }
}
}
***************
*** 266,272 ****
// A very similar version of that code exists also in the kdevelop
// project generator.
! for (std::map<std::string, std::string>::const_iterator
! sit=sourceFiles.begin();
! sit!=sourceFiles.end();
++sit)
{
--- 294,300 ----
// A very similar version of that code exists also in the kdevelop
// project generator.
! for (std::map<std::string, cmSourceFile*>::const_iterator
! sit=cFiles.begin();
! sit!=cFiles.end();
++sit)
{
***************
*** 284,290 ****
hname += ".";
hname += *ext;
if(cmSystemTools::FileExists(hname.c_str()))
{
! sourceFiles[hname] = hname;
break;
}
--- 312,325 ----
hname += ".";
hname += *ext;
+ // if it's already in the set, don't check if it exists on disk
+ std::set<std::string>::const_iterator headerIt=otherFiles.find(hname);
+ if (headerIt != otherFiles.end())
+ {
+ break;
+ }
+
if(cmSystemTools::FileExists(hname.c_str()))
{
! otherFiles.insert(hname);
break;
}
***************
*** 292,302 ****
}
! // insert all used source files in the CodeBlocks project
! for (std::map<std::string, std::string>::const_iterator
! sit=sourceFiles.begin();
! sit!=sourceFiles.end();
++sit)
{
! fout<<" <Unit filename=\""<<sit->first <<"\">\n"
" </Unit>\n";
}
--- 327,346 ----
}
! // insert all source files in the CodeBlocks project
! // first the C/C++ implementation files, then all others
! for (std::map<std::string, cmSourceFile*>::const_iterator
! sit=cFiles.begin();
! sit!=cFiles.end();
++sit)
{
! fout<<" <Unit filename=\""<< sit->first <<"\">\n"
! " </Unit>\n";
! }
! for (std::set<std::string>::const_iterator
! sit=otherFiles.begin();
! sit!=otherFiles.end();
! ++sit)
! {
! fout<<" <Unit filename=\""<< sit->c_str() <<"\">\n"
" </Unit>\n";
}
More information about the Cmake-commits
mailing list