Add a feature check to test availability of auto_ptr

This commit is contained in:
Daniel Pfeifer 2016-09-23 21:49:12 +02:00 committed by Brad King
parent 6757e66089
commit 67480c05e3
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#include <memory>
std::auto_ptr<int> get_auto_ptr()
{
std::auto_ptr<int> ptr;
ptr = std::auto_ptr<int>(new int(0));
return ptr;
}
int use_auto_ptr(std::auto_ptr<int> ptr)
{
return *ptr;
}
int main()
{
return use_auto_ptr(get_auto_ptr());
}

View File

@ -32,6 +32,7 @@ function(cm_check_cxx_feature name)
endfunction()
if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(auto_ptr)
cm_check_cxx_feature(make_unique)
if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)

View File

@ -30,6 +30,7 @@
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMAKE_ENCODING_UTF8
#cmakedefine CMake_HAVE_CXX_AUTO_PTR
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_NULLPTR
#cmakedefine CMake_HAVE_CXX_OVERRIDE