diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-06-22 22:37:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-06-27 14:37:41 (GMT) |
commit | 5286110d6f106e03ee6c5bdeea48d62674656c9f (patch) | |
tree | 06ff5fe903c116e5c4f6dbe384c4e3f01e2ddc17 | |
parent | 09aa2c94186081267753dedb50acb102717a6577 (diff) | |
download | CMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.zip CMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.tar.gz CMake-5286110d6f106e03ee6c5bdeea48d62674656c9f.tar.bz2 |
cxx features: add check for override
-rw-r--r-- | Source/Checks/cm_cxx_features.cmake | 1 | ||||
-rw-r--r-- | Source/Checks/cm_cxx_override.cxx | 20 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 7 | ||||
-rwxr-xr-x | bootstrap | 1 |
4 files changed, 29 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index e550e64..18dbaf8 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,7 @@ function(cm_check_cxx_feature name) endfunction() if(CMAKE_CXX_STANDARD) + cm_check_cxx_feature(override) cm_check_cxx_feature(unordered_map) cm_check_cxx_feature(unordered_set) endif() diff --git a/Source/Checks/cm_cxx_override.cxx b/Source/Checks/cm_cxx_override.cxx new file mode 100644 index 0000000..9395a0a --- /dev/null +++ b/Source/Checks/cm_cxx_override.cxx @@ -0,0 +1,20 @@ +struct Foo +{ + virtual int test() const = 0; +}; + +struct Bar : Foo +{ + int test() const override { return 0; } +}; + +int test(Foo const& foo) +{ + return foo.test(); +} + +int main() +{ + Bar const bar; + return test(bar); +} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index a723942..a8d4f58 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -29,9 +29,16 @@ #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER #cmakedefine CMAKE_ENCODING_UTF8 +#cmakedefine CMake_HAVE_CXX_OVERRIDE #cmakedefine CMake_HAVE_CXX_UNORDERED_MAP #cmakedefine CMake_HAVE_CXX_UNORDERED_SET #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" +#ifdef CMake_HAVE_CXX_OVERRIDE +#define CM_OVERRIDE override +#else +#define CM_OVERRIDE +#endif + #endif @@ -1272,6 +1272,7 @@ 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_OVERRIDE" # Regenerate configured headers for h in Configure VersionConfig; do |