From 09aa2c94186081267753dedb50acb102717a6577 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 23 Jun 2016 00:29:47 +0200 Subject: Use where available --- Source/Checks/cm_cxx_features.cmake | 1 + Source/Checks/cm_cxx_unordered_set.cxx | 7 +++++++ Source/cmConfigure.cmake.h.in | 1 + Source/cmGeneratorTarget.cxx | 5 ++++- Source/cmTarget.cxx | 6 +++++- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Source/Checks/cm_cxx_unordered_set.cxx 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 +int main() +{ + std::unordered_set 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 -#if defined(CMAKE_BUILD_WITH_CMAKE) +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #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 #include #include // required for atof -#if defined(CMAKE_BUILD_WITH_CMAKE) + +#if defined(CMake_HAVE_CXX_UNORDERED_SET) +#include +#define UNORDERED_SET std::unordered_set +#elif defined(CMAKE_BUILD_WITH_CMAKE) #include #define UNORDERED_SET cmsys::hash_set #else -- cgit v0.12