summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-10-24 20:33:18 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-10-24 20:34:52 (GMT)
commitc15dc1972839e175afaa9011f74376dadf08277f (patch)
treef6c1dc85793438cc0337a7870e1bd33a81849077 /Source/cmGeneratorTarget.cxx
parentf660832999e086f02a9f3552c028aed900cd7249 (diff)
downloadCMake-c15dc1972839e175afaa9011f74376dadf08277f.zip
CMake-c15dc1972839e175afaa9011f74376dadf08277f.tar.gz
CMake-c15dc1972839e175afaa9011f74376dadf08277f.tar.bz2
Introduce CM_UNORDERED_SET
Avoid duplicating switch among std::unordered_set, cmsys::hash_set, and std::set.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx49
1 files changed, 22 insertions, 27 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 8ac302a..ca056c0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -21,6 +21,7 @@
#include "cmTargetLinkLibraryType.h"
#include "cmTargetPropertyComputer.h"
#include "cm_auto_ptr.hxx"
+#include "cm_unordered_set.hxx"
#include "cmake.h"
#include <algorithm>
@@ -34,16 +35,6 @@
#include <stdlib.h>
#include <string.h>
-#if defined(CMake_HAVE_CXX_UNORDERED_SET)
-#include <unordered_set>
-#define UNORDERED_SET std::unordered_set
-#elif defined(CMAKE_BUILD_WITH_CMAKE)
-#include <cmsys/hash_set.hxx>
-#define UNORDERED_SET cmsys::hash_set
-#else
-#define UNORDERED_SET std::set
-#endif
-
template <>
const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
cmGeneratorTarget const* tgt, cmMessenger* /* messenger */,
@@ -926,7 +917,7 @@ static void AddInterfaceEntries(
static bool processSources(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& srcs, UNORDERED_SET<std::string>& uniqueSrcs,
+ std::vector<std::string>& srcs, CM_UNORDERED_SET<std::string>& uniqueSrcs,
cmGeneratorExpressionDAGChecker* dagChecker, std::string const& config,
bool debugSources)
{
@@ -1053,7 +1044,7 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
CM_NULLPTR, CM_NULLPTR);
- UNORDERED_SET<std::string> uniqueSrcs;
+ CM_UNORDERED_SET<std::string> uniqueSrcs;
bool contextDependentDirectSources =
processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker,
config, debugSources);
@@ -1592,7 +1583,7 @@ class cmTargetCollectLinkLanguages
public:
cmTargetCollectLinkLanguages(cmGeneratorTarget const* target,
const std::string& config,
- UNORDERED_SET<std::string>& languages,
+ CM_UNORDERED_SET<std::string>& languages,
cmGeneratorTarget const* head)
: Config(config)
, Languages(languages)
@@ -1659,7 +1650,7 @@ public:
private:
std::string Config;
- UNORDERED_SET<std::string>& Languages;
+ CM_UNORDERED_SET<std::string>& Languages;
cmGeneratorTarget const* HeadTarget;
const cmGeneratorTarget* Target;
std::set<cmGeneratorTarget const*> Visited;
@@ -1731,7 +1722,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
LinkClosure& lc) const
{
// Get languages built in this target.
- UNORDERED_SET<std::string> languages;
+ CM_UNORDERED_SET<std::string> languages;
cmLinkImplementation const* impl = this->GetLinkImplementation(config);
assert(impl);
for (std::vector<std::string>::const_iterator li = impl->Languages.begin();
@@ -1748,7 +1739,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Store the transitive closure of languages.
- for (UNORDERED_SET<std::string>::const_iterator li = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator li = languages.begin();
li != languages.end(); ++li) {
lc.Languages.push_back(*li);
}
@@ -1769,7 +1760,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Now consider languages that propagate from linked targets.
- for (UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
sit != languages.end(); ++sit) {
std::string propagates =
"CMAKE_" + *sit + "_LINKER_PREFERENCE_PROPAGATES";
@@ -2338,7 +2329,7 @@ static void processIncludeDirectories(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
std::vector<std::string>& includes,
- UNORDERED_SET<std::string>& uniqueIncludes,
+ CM_UNORDERED_SET<std::string>& uniqueIncludes,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugIncludes, const std::string& language)
{
@@ -2451,7 +2442,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
const std::string& config, const std::string& lang) const
{
std::vector<std::string> includes;
- UNORDERED_SET<std::string> uniqueIncludes;
+ CM_UNORDERED_SET<std::string> uniqueIncludes;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
@@ -2528,7 +2519,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
static void processCompileOptionsInternal(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, const char* logName, std::string const& language)
{
@@ -2565,7 +2557,8 @@ static void processCompileOptionsInternal(
static void processCompileOptions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2578,7 +2571,7 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
@@ -2618,7 +2611,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
static void processCompileFeatures(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions)
{
@@ -2630,7 +2624,7 @@ static void processCompileFeatures(
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
const std::string& config) const
{
- UNORDERED_SET<std::string> uniqueFeatures;
+ CM_UNORDERED_SET<std::string> uniqueFeatures;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
@@ -2667,7 +2661,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
static void processCompileDefinitions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2680,7 +2675,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
std::vector<std::string>& list, const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
@@ -4149,7 +4144,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
- UNORDERED_SET<std::string> emitted;
+ CM_UNORDERED_SET<std::string> emitted;
for (std::vector<cmLinkItem>::const_iterator li =
iface.Libraries.begin();
li != iface.Libraries.end(); ++li) {