diff --git a/py/usermod.cmake b/py/usermod.cmake index 93fce13b3007..4a8b99ff31b4 100644 --- a/py/usermod.cmake +++ b/py/usermod.cmake @@ -42,6 +42,10 @@ endfunction() # Include CMake files for user modules. if (USER_C_MODULES) foreach(USER_C_MODULE_PATH ${USER_C_MODULES}) + # If a directory is given, append the micropython.cmake to it. + if (IS_DIRECTORY ${USER_C_MODULE_PATH}) + set(USER_C_MODULE_PATH "${USER_C_MODULE_PATH}/micropython.cmake") + endif() # Confirm the provided path exists, show abspath if not to make it clearer to fix. if (NOT EXISTS ${USER_C_MODULE_PATH}) get_filename_component(USER_C_MODULES_ABS "${USER_C_MODULE_PATH}" ABSOLUTE)