[Cmake-commits] CMake branch, next, updated. v3.2.0-867-g26594e5
Nils Gladitz
nilsgladitz at gmail.com
Fri Mar 6 09:08:00 EST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 26594e5deb1e9c8e3332cd52da9f96c5ed196d9b (commit)
via 099b0cab1d12b5b3734342ac516c8d42c78cdef7 (commit)
from 096abecb3fc9fac10514c7cb48a2c04056273520 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26594e5deb1e9c8e3332cd52da9f96c5ed196d9b
commit 26594e5deb1e9c8e3332cd52da9f96c5ed196d9b
Merge: 096abec 099b0ca
Author: Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Mar 6 09:07:59 2015 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 6 09:07:59 2015 -0500
Merge topic 'cbp-unit-targets' into next
099b0cab CodeBlocks: Declare which source file belongs to which targets.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=099b0cab1d12b5b3734342ac516c8d42c78cdef7
commit 099b0cab1d12b5b3734342ac516c8d42c78cdef7
Author: Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Mar 6 09:48:33 2015 +0100
Commit: Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Fri Mar 6 09:48:33 2015 +0100
CodeBlocks: Declare which source file belongs to which targets.
This should allow the consuming IDE to determine which target specific
preprocessor definitions and include directories are relevant for a
given source file.
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 69857ef..d46d941 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -376,11 +376,13 @@ void cmExtraCodeBlocksGenerator
fout<<" </Build>\n";
- // 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;
+ // Collect all used source files in the project.
+ // Keep a list of C/C++ source files which might have an acompanying header
+ // that should be looked for.
+ typedef std::map<std::string, CbpUnit> all_files_map_t;
+ all_files_map_t allFiles;
+ std::vector<std::string> cFiles;
+
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++)
{
@@ -429,15 +431,15 @@ void cmExtraCodeBlocksGenerator
}
}
- // then put it accordingly into one of the two containers
- if (isCFile)
- {
- cFiles[(*si)->GetFullPath()] = *si ;
- }
- else
+ std::string fullPath = (*si)->GetFullPath();
+
+ if(isCFile)
{
- otherFiles.insert((*si)->GetFullPath());
+ cFiles.push_back(fullPath);
}
+
+ CbpUnit &cbpUnit = allFiles[fullPath];
+ cbpUnit.Targets.push_back(&(ti->second));
}
}
default: // intended fallthrough
@@ -447,19 +449,21 @@ void cmExtraCodeBlocksGenerator
}
// The following loop tries to add header files matching to implementation
- // files to the project. It does that by iterating over all source files,
+ // files to the project. It does that by iterating over all
+ // C/C++ source files,
// replacing the file name extension with ".h" and checks whether such a
// file exists. If it does, it is inserted into the map of files.
// A very similar version of that code exists also in the kdevelop
// project generator.
- for (std::map<std::string, cmSourceFile*>::const_iterator
+ for (std::vector<std::string>::const_iterator
sit=cFiles.begin();
sit!=cFiles.end();
++sit)
{
- std::string headerBasename=cmSystemTools::GetFilenamePath(sit->first);
+ std::string const& fileName = *sit;
+ std::string headerBasename=cmSystemTools::GetFilenamePath(fileName);
headerBasename+="/";
- headerBasename+=cmSystemTools::GetFilenameWithoutExtension(sit->first);
+ headerBasename+=cmSystemTools::GetFilenameWithoutExtension(fileName);
// check if there's a matching header around
for(std::vector<std::string>::const_iterator
@@ -471,37 +475,38 @@ void cmExtraCodeBlocksGenerator
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())
+ if (allFiles.find(hname) != allFiles.end())
{
break;
}
if(cmSystemTools::FileExists(hname.c_str()))
{
- otherFiles.insert(hname);
+ allFiles[hname].Targets = allFiles[fileName].Targets;
break;
}
}
}
// 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();
+ for (all_files_map_t::const_iterator
+ sit=allFiles.begin();
+ sit!=allFiles.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 <<"\">\n"
- " </Unit>\n";
+ std::string const& unitFilename = sit->first;
+ CbpUnit const& unit = sit->second;
+
+ fout<<" <Unit filename=\""<< cmXMLSafe(unitFilename) <<"\">\n";
+
+ for(std::vector<const cmTarget*>::const_iterator ti = unit.Targets.begin();
+ ti != unit.Targets.end(); ++ti)
+ {
+ std::string const& targetName = (*ti)->GetName();
+ fout<<" <Option target=\""<< cmXMLSafe(targetName) <<"\"/>\n";
+ }
+
+ fout<<" </Unit>\n";
}
// Add CMakeLists.txt
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index 0435ad8..97da1b8 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -39,6 +39,10 @@ public:
virtual void Generate();
private:
+ struct CbpUnit
+ {
+ std::vector<const cmTarget*> Targets;
+ };
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
-----------------------------------------------------------------------
Summary of changes:
Source/cmExtraCodeBlocksGenerator.cxx | 71 ++++++++++++++++++---------------
Source/cmExtraCodeBlocksGenerator.h | 4 ++
2 files changed, 42 insertions(+), 33 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list