summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/Checks/cm_cxx_eq_delete.cxx14
-rw-r--r--Source/Checks/cm_cxx_features.cmake1
-rw-r--r--Source/cmConfigure.cmake.h.in11
-rwxr-xr-xbootstrap2
4 files changed, 28 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx_eq_delete.cxx b/Source/Checks/cm_cxx_eq_delete.cxx
new file mode 100644
index 0000000..809e4cf
--- /dev/null
+++ b/Source/Checks/cm_cxx_eq_delete.cxx
@@ -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();
+}
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index 80c9f3b..cd58539 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -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)
diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in
index e30b43f..970fde5 100644
--- a/Source/cmConfigure.cmake.h.in
+++ b/Source/cmConfigure.cmake.h.in
@@ -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
diff --git a/bootstrap b/bootstrap
index 4f58365..e957e82 100755
--- a/bootstrap
+++ b/bootstrap
@@ -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