diff --git a/CMakeCommon/SetCompilerFlags.cmake b/CMakeCommon/SetCompilerFlags.cmake index a34734f..95140b2 100644 --- a/CMakeCommon/SetCompilerFlags.cmake +++ b/CMakeCommon/SetCompilerFlags.cmake @@ -26,19 +26,24 @@ # function(SetGNUCompilerFlags compiler_libs) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - if(DEFINED CMAKE_SYSTEM_PROCESSOR) + if(DEFINED __TriCore__) set(compiler_libs PARENT_SCOPE) - set(common_flags "-fno-common -Os -std=c99") - set(warning_flags "-W -Wall -Wextra -Wdiv-by-zero -Warray-bounds -Wcast-align -Wignored-qualifiers -Wformat -Wformat-security") + set(common_c_flags "-fno-common -Os -std=c99") + set(common_cxx_flags "-fno-common -std=c++0x") + set(warning_flags "-W -Wall -Wextra") set(target_flags "-DAPPKIT_TC277TFT -DEMBB_DEBUG -fshort-double -mcpu=tc27xx -mversion-info") if (WARNINGS_ARE_ERRORS STREQUAL ON) set(warning_flags "${warning_flags} -Werror") endif() if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${common_flags} ${warning_flags} ${target_flags}" + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${common_c_flags} ${warning_flags} ${target_flags}" PARENT_SCOPE) endif() + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${common_cxx_flags} ${warning_flags} ${target_flags}" + PARENT_SCOPE) + endif() else() set(compiler_libs pthread rt PARENT_SCOPE) # -Wall -> All warnings