summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-22 22:29:47 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-27 14:37:40 (GMT)
commit09aa2c94186081267753dedb50acb102717a6577 (patch)
treec977768b01f2955eb66fd5a58a58a61a82f57ace
parentea5477e43de4660343897e4669bc5809dc4ddabe (diff)
downloadCMake-09aa2c94186081267753dedb50acb102717a6577.zip
CMake-09aa2c94186081267753dedb50acb102717a6577.tar.gz
CMake-09aa2c94186081267753dedb50acb102717a6577.tar.bz2
Use <unordered_set> where available
-rw-r--r--Source/Checks/cm_cxx_features.cmake1
-rw-r--r--Source/Checks/cm_cxx_unordered_set.cxx7
-rw-r--r--Source/cmConfigure.cmake.h.in1
-rw-r--r--Source/cmGeneratorTarget.cxx5
-rw-r--r--Source/cmTarget.cxx6
5 files changed, 18 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index b0ecc4c..e550e64 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -33,4 +33,5 @@ endfunction()
if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(unordered_map)
+ cm_check_cxx_feature(unordered_set)
endif()
diff --git a/Source/Checks/cm_cxx_unordered_set.cxx b/Source/Checks/cm_cxx_unordered_set.cxx
new file mode 100644
index 0000000..de4bb77
--- /dev/null
+++ b/Source/Checks/cm_cxx_unordered_set.cxx
@@ -0,0 +1,7 @@
+#include <unordered_set>
+int main()
+{
+ std::unordered_set<int> set;
+ set.insert(0);
+ return 0;
+}
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index 4c5ad2a..a723942 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -30,6 +30,7 @@
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_ENCODING_UTF8
#cmakedefine CMake_HAVE_CXX_UNORDERED_MAP
+#cmakedefine CMake_HAVE_CXX_UNORDERED_SET
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 9a025d9..3668c82 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -27,7 +27,10 @@
#include "assert.h"
#include <errno.h>
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+#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
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4386080..5e5ed2b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -27,7 +27,11 @@
#include <map>
#include <set>
#include <stdlib.h> // required for atof
-#if defined(CMAKE_BUILD_WITH_CMAKE)
+
+#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