Introduce toolchain_cc_cpp_*-family of macros. Move the following into the toolchain_cc_cpp_* macros: * Common base set of flags * C++ standard version * RTTI * Exceptions These macros must be implemented by every compiler port. These macros set the respective flags, but leaves logic and control to the root CMakeLists.txt file. No functional change expected. Clang's C++ flags are compatible with gcc, and are thus inherited. This is motivated by the wish to abstract Zephyr's usage of toolchains, permitting easier porting to other (commercial) toolchains. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
# See root CMakeLists.txt for description and expectations of these macros
|
|
|
|
macro(toolchain_cc_cpp_base_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-fcheck-new")
|
|
endmacro()
|
|
|
|
# The "register" keyword was deprecated since C++11, but not for C++98
|
|
macro(toolchain_cc_cpp_dialect_std_98_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-std=c++98")
|
|
endmacro()
|
|
macro(toolchain_cc_cpp_dialect_std_11_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-std=c++11")
|
|
list(APPEND ${dest_list_name} "-Wno-register")
|
|
endmacro()
|
|
macro(toolchain_cc_cpp_dialect_std_14_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-std=c++14")
|
|
list(APPEND ${dest_list_name} "-Wno-register")
|
|
endmacro()
|
|
macro(toolchain_cc_cpp_dialect_std_17_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-std=c++17")
|
|
list(APPEND ${dest_list_name} "-Wno-register")
|
|
endmacro()
|
|
macro(toolchain_cc_cpp_dialect_std_2a_flags dest_list_name)
|
|
list(APPEND ${dest_list_name} "-std=c++2a")
|
|
list(APPEND ${dest_list_name} "-Wno-register")
|
|
endmacro()
|
|
|
|
macro(toolchain_cc_cpp_no_exceptions_flag dest_var_name)
|
|
set_ifndef(${dest_var_name} "-fno-exceptions")
|
|
endmacro()
|
|
|
|
macro(toolchain_cc_cpp_no_rtti_flag dest_var_name)
|
|
set_ifndef(${dest_var_name} "-fno-rtti")
|
|
endmacro()
|