cmConfigure: provide macros CM_EQ_DELETE and CM_DISABLE_COPY

This commit is contained in:
Daniel Pfeifer 2017-04-22 10:09:41 +02:00
parent e9d1ca782e
commit 5d1671324b
4 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,14 @@
struct Foo
{
Foo() {}
~Foo() {}
Foo(Foo const&) = delete;
Foo& operator=(Foo const&) = delete;
int test() const { return 0; }
};
int main()
{
Foo const foo;
return foo.test();
}

View File

@ -33,6 +33,7 @@ endfunction()
if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(auto_ptr)
cm_check_cxx_feature(eq_delete)
cm_check_cxx_feature(make_unique)
if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)

View File

@ -21,6 +21,7 @@
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMake_HAVE_CXX_AUTO_PTR
#cmakedefine CMake_HAVE_CXX_EQ_DELETE
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_NULLPTR
#cmakedefine CMake_HAVE_CXX_OVERRIDE
@ -30,6 +31,12 @@
#define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@"
#define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@"
#ifdef CMake_HAVE_CXX_EQ_DELETE
#define CM_EQ_DELETE = delete
#else
#define CM_EQ_DELETE
#endif
#ifdef CMake_HAVE_CXX_NULLPTR
#define CM_NULLPTR nullptr
#else
@ -42,4 +49,8 @@
#define CM_OVERRIDE
#endif
#define CM_DISABLE_COPY(Class) \
Class(Class const&) CM_EQ_DELETE; \
Class& operator=(Class const&) CM_EQ_DELETE;
#endif

View File

@ -1369,8 +1369,10 @@ cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
cmake_report cmConfigure.h${_tmp} "#define CM_EQ_DELETE"
cmake_report cmConfigure.h${_tmp} "#define CM_NULLPTR 0"
cmake_report cmConfigure.h${_tmp} "#define CM_OVERRIDE"
cmake_report cmConfigure.h${_tmp} "#define CM_DISABLE_COPY(Class)"
# Regenerate configured headers
for h in Configure VersionConfig; do