Merge topic 'check-for-unique_ptr'

aa50cdac Check for availability of unique_ptr and make_unique when building CMake
This commit is contained in:
Brad King 2016-09-19 08:55:09 -04:00 committed by CMake Topic Stage
commit 0a4d15a9e2
4 changed files with 19 additions and 0 deletions

View File

@ -32,8 +32,13 @@ function(cm_check_cxx_feature name)
endfunction() endfunction()
if(CMAKE_CXX_STANDARD) if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(make_unique)
if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)
endif()
cm_check_cxx_feature(nullptr) cm_check_cxx_feature(nullptr)
cm_check_cxx_feature(override) cm_check_cxx_feature(override)
cm_check_cxx_feature(unique_ptr)
cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_map)
cm_check_cxx_feature(unordered_set) cm_check_cxx_feature(unordered_set)
endif() endif()

View File

@ -0,0 +1,6 @@
#include <memory>
int main()
{
std::unique_ptr<int> u = std::make_unique<int>(0);
return *u;
}

View File

@ -0,0 +1,6 @@
#include <memory>
int main()
{
std::unique_ptr<int> u(new int(0));
return *u;
}

View File

@ -30,8 +30,10 @@
#cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_USE_LIBUV #cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMAKE_ENCODING_UTF8 #cmakedefine CMAKE_ENCODING_UTF8
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_NULLPTR #cmakedefine CMake_HAVE_CXX_NULLPTR
#cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_OVERRIDE
#cmakedefine CMake_HAVE_CXX_UNIQUE_PTR
#cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP
#cmakedefine CMake_HAVE_CXX_UNORDERED_SET #cmakedefine CMake_HAVE_CXX_UNORDERED_SET
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"