Make a module set defconfig values when used

Windows 11, VSCode, NCS v2.3.0

I have a custom module.  It has code relating to many common features.

I have two applications.  Each application has a prj.conf file which is the same.

Any application which uses the custom module needs to set those prj.conf values.

How can set those configuration values simply by importing the module?

To be clear, when I say import a module, I mean I'm using a zephyr-defined module, imported by appending to ZEPHYR_EXTRA_MODULES in each application.  The module directory has a zephyr/module.yml file, etc.

I see that the module.yml file is able to have a Kconfig file specified.  But I don't see that Kconfig.defconfig is recognized or processed.

Here is the set of files I have tried to work with:

My zephyr/module.yml file is this:

build:
  cmake: .
  kconfig: Kconfig

As an example, I want to enable CONFIG_CPLUSPLUS=y.

I have tried (and failed at):

In my Kconfig file:

config NO_CHOICE
	bool "you want this"
    default true
	help
	  You want this
    select CPLUSPLUS

It seems to have no effect.

Is there some other syntax or technique that will work?

The Kconfig.defconfig has this:

CONFIG_CPLUSPLUS=y

Also not working.  I believe not even being processed.

I have tried modifying the CMakeLists.txt:

set(CONFIG_CPLUSPLUS "y")
set(CPLUSPLUS "y")

Also doesn't work.

If there are no good options, are there any hacky ones?

For example, can I have a prj.conf file that lives within the module directory, and is somehow #include'd or source'd into each application prj.conf (in addition any other tweaks I may make in each application prj.conf)?

Thanks.

Related