diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a9ce720a..fe4c7a729 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,6 +196,29 @@ if(HAVE_LIBEXECINFO) set(HAVE_BACKTRACE_SYMBOLS TRUE) endif() +if(UNIX) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-std=c++11" CXX_FLAG_CXX11) + check_cxx_compiler_flag("-std=c++0x" CXX_FLAG_CXX0X) + if(CXX_FLAG_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + elseif(CXX_FLAG_CXX0X) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + endif() + + check_cxx_compiler_flag("-Wno-inconsistent-missing-override" CXX_FLAG_NO_OVERRIDE_WARNING) + if(CXX_FLAG_NO_OVERRIDE_WARNING) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override") + endif() +endif() + +include(CheckCXXSourceCompiles) +check_cxx_source_compiles("class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE) + +if(NOT CXX_FEATURE_OVERRIDE) + add_definitions("-Doverride=") +endif() + configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ESCAPE_QUOTES) install( diff --git a/lib/config/CMakeLists.txt b/lib/config/CMakeLists.txt index 52cbf5640..1a54fc986 100644 --- a/lib/config/CMakeLists.txt +++ b/lib/config/CMakeLists.txt @@ -24,6 +24,11 @@ set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY EXCLUD flex_target(config_lexer config_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc) set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc PROPERTY EXCLUDE_UNITY_BUILD TRUE) +if(UNIX) + set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_parser.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register") + set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/config_lexer.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register") +endif() + add_flex_bison_dependency(config_lexer config_parser) mkembedconfig_target(base-type.conf base-type.cpp) diff --git a/tools/mkclass/CMakeLists.txt b/tools/mkclass/CMakeLists.txt index a94c6046d..f49ed9eb3 100644 --- a/tools/mkclass/CMakeLists.txt +++ b/tools/mkclass/CMakeLists.txt @@ -22,6 +22,11 @@ bison_target(class_parser class_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/class_pars flex_target(class_lexer class_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc) add_flex_bison_dependency(class_lexer class_parser) +if(UNIX) + set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/class_parser.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register") + set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register") +endif() + include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) add_executable(mkclass mkclass.cpp classcompiler.cpp classcompiler.hpp ${FLEX_class_lexer_OUTPUTS} ${BISON_class_parser_OUTPUTS})