diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-16 04:57:53 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-18 22:07:02 (GMT) |
commit | d7923b82ade9f84d0fc4c6d44b9719f2f7c0e9af (patch) | |
tree | 2d563a0bbb66f63bc9e03b03fc3ff15cd14cbc02 /Source/Checks | |
parent | 820777af03041c21d7b36e80135382e7161c1ebd (diff) | |
download | CMake-d7923b82ade9f84d0fc4c6d44b9719f2f7c0e9af.zip CMake-d7923b82ade9f84d0fc4c6d44b9719f2f7c0e9af.tar.gz CMake-d7923b82ade9f84d0fc4c6d44b9719f2f7c0e9af.tar.bz2 |
Use std::unordered_map instead of hash_map where available.
Diffstat (limited to 'Source/Checks')
-rw-r--r-- | Source/Checks/cm_cxx11_unordered_map.cmake | 25 | ||||
-rw-r--r-- | Source/Checks/cm_cxx11_unordered_map.cpp | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx11_unordered_map.cmake b/Source/Checks/cm_cxx11_unordered_map.cmake new file mode 100644 index 0000000..80fe391 --- /dev/null +++ b/Source/Checks/cm_cxx11_unordered_map.cmake @@ -0,0 +1,25 @@ + +if(CMAKE_CXX_STANDARD AND NOT DEFINED CMake_HAVE_CXX11_UNORDERED_MAP) + message(STATUS "Checking if compiler supports C++11 unordered_map") + try_compile(CMake_HAVE_CXX11_UNORDERED_MAP + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_LIST_DIR}/cm_cxx11_unordered_map.cpp + CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + OUTPUT_VARIABLE OUTPUT + ) + if(CMake_HAVE_CXX11_UNORDERED_MAP) + message(STATUS "Checking if compiler supports C++11 unordered_map - yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if compiler supports C++11 unordered_map passed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + else() + message(STATUS "Checking if compiler supports C++11 unordered_map - no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler supports C++11 unordered_map failed with the following output:\n" + "${OUTPUT}\n" + "\n" + ) + endif() +endif() diff --git a/Source/Checks/cm_cxx11_unordered_map.cpp b/Source/Checks/cm_cxx11_unordered_map.cpp new file mode 100644 index 0000000..beeb31b --- /dev/null +++ b/Source/Checks/cm_cxx11_unordered_map.cpp @@ -0,0 +1,6 @@ +#include <unordered_map> +int main() { + std::unordered_map<int, int> map; + map[0] = 0; + return 0; +} |