examples/usercmodules: Simplify user C module enabling.

It's a bit of a pitfall with user C modules that including them in the
build does not automatically enable them.  This commit changes the docs and
examples for user C modules to encourage writers of user C modules to
enable them unconditionally.  This makes things simpler and covers most use
cases.

See discussion in issue #6960, and also #7086.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-03-31 00:45:43 +11:00
parent ec79e44502
commit d87f42b0e5
7 changed files with 22 additions and 25 deletions

View File

@@ -12,11 +12,5 @@ target_include_directories(usermod_cppexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)
# Enable the module automatically by adding the relevant compile definitions.
target_compile_definitions(usermod_cppexample INTERFACE
MODULE_CPPEXAMPLE_ENABLED=1
)
# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cppexample)