cxx features: add check for override

This commit is contained in:
Daniel Pfeifer 2016-06-23 00:37:10 +02:00 committed by Brad King
parent 09aa2c9418
commit 5286110d6f
4 changed files with 29 additions and 0 deletions

View File

@ -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()

View File

@ -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);
}

View File

@ -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

View File

@ -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