c++: kconfig: Fix choice dependencies and use 'menuconfig' symbol
- Make the 'C++ Standard' choice depend on CPLUSPLUS, so that it only shows up when C++ support is enabled. Also check that CPLUSPLUS is enabled before checking the standard in the top-level CMakeLists.txt, to avoid triggering an assert. - The 'C++ Options' menu now contains just CPLUSPLUS and its indented children. Remove one menu level by removing the menu and turning CPLUSPLUS into a 'menuconfig' symbol. Also change the prompt from "Enable C++ support for the application" to just "C++ support for the application", to make it consistent with e.g. "Logging". - Factor out the common CPLUSPLUS dependency with an 'if CPLUSPLUS'. - Order symbol properties more consistently with other Kconfig files, with the prompt at the top, etc. Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
parent
cbecaddff1
commit
9b6c2f4bf3
|
@ -149,6 +149,7 @@ toolchain_cc_cpp_dialect_std_14_flags(CPP_DIALECT_STD_14_FLAGS)
|
||||||
toolchain_cc_cpp_dialect_std_17_flags(CPP_DIALECT_STD_17_FLAGS)
|
toolchain_cc_cpp_dialect_std_17_flags(CPP_DIALECT_STD_17_FLAGS)
|
||||||
toolchain_cc_cpp_dialect_std_2a_flags(CPP_DIALECT_STD_2A_FLAGS)
|
toolchain_cc_cpp_dialect_std_2a_flags(CPP_DIALECT_STD_2A_FLAGS)
|
||||||
|
|
||||||
|
if(CONFIG_CPLUSPLUS)
|
||||||
# From kconfig choice, pick a single dialect.
|
# From kconfig choice, pick a single dialect.
|
||||||
# Kconfig choice ensures only one of these CONFIG_STD_CPP* is set.
|
# Kconfig choice ensures only one of these CONFIG_STD_CPP* is set.
|
||||||
if(CONFIG_STD_CPP98)
|
if(CONFIG_STD_CPP98)
|
||||||
|
@ -170,6 +171,7 @@ foreach(flag ${STD_CPP_DIALECT_FLAGS})
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:${flag}>
|
$<$<COMPILE_LANGUAGE:CXX>:${flag}>
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT CONFIG_EXCEPTIONS)
|
if(NOT CONFIG_EXCEPTIONS)
|
||||||
# @Intent: Obtain compiler specific flags related to C++ Exceptions
|
# @Intent: Obtain compiler specific flags related to C++ Exceptions
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
menu "C++ Options"
|
menuconfig CPLUSPLUS
|
||||||
|
bool "C++ support for the application"
|
||||||
config CPLUSPLUS
|
|
||||||
bool "Enable C++ support for the application"
|
|
||||||
help
|
help
|
||||||
This option enables the use of applications built with C++.
|
This option enables the use of applications built with C++.
|
||||||
|
|
||||||
|
if CPLUSPLUS
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "C++ Standard"
|
prompt "C++ Standard"
|
||||||
default STD_CPP11
|
default STD_CPP11
|
||||||
|
@ -48,24 +48,21 @@ config STD_CPP2A
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config LIB_CPLUSPLUS
|
config LIB_CPLUSPLUS
|
||||||
depends on CPLUSPLUS
|
|
||||||
bool "Link with STD C++ library"
|
bool "Link with STD C++ library"
|
||||||
help
|
help
|
||||||
Link with STD C++ Library.
|
Link with STD C++ Library.
|
||||||
|
|
||||||
config EXCEPTIONS
|
config EXCEPTIONS
|
||||||
depends on CPLUSPLUS
|
|
||||||
depends on NEWLIB_LIBC
|
|
||||||
select LIB_CPLUSPLUS
|
|
||||||
bool "Enable C++ exceptions support"
|
bool "Enable C++ exceptions support"
|
||||||
|
select LIB_CPLUSPLUS
|
||||||
|
depends on NEWLIB_LIBC
|
||||||
help
|
help
|
||||||
This option enables support of C++ exceptions.
|
This option enables support of C++ exceptions.
|
||||||
|
|
||||||
config RTTI
|
config RTTI
|
||||||
depends on CPLUSPLUS
|
|
||||||
select LIB_CPLUSPLUS
|
|
||||||
bool "Enable C++ RTTI support"
|
bool "Enable C++ RTTI support"
|
||||||
|
select LIB_CPLUSPLUS
|
||||||
help
|
help
|
||||||
This option enables support of C++ RTTI.
|
This option enables support of C++ RTTI.
|
||||||
|
|
||||||
endmenu
|
endif # CPLUSPLUS
|
||||||
|
|
Loading…
Reference in a new issue