diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake index d6a4aedb85c68..a4f8d394f5c5e 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake @@ -225,6 +225,7 @@ idf_component_register( ${MICROPY_SOURCE_PORT} ${MICROPY_SOURCE_BOARD} ${MICROPY_SOURCE_TINYUSB} + ${MICROPY_SOURCE_USERMOD} INCLUDE_DIRS ${MICROPY_INC_CORE} ${MICROPY_INC_USERMOD} diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 2be74151d87bf..396ad36e5c08a 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -510,6 +510,7 @@ target_sources(${MICROPY_TARGET} PRIVATE ${MICROPY_SOURCE_DRIVERS} ${MICROPY_SOURCE_PORT} ${MICROPY_SOURCE_BOARD} + ${MICROPY_SOURCE_USERMOD} ) target_link_libraries(${MICROPY_TARGET} micropy_lib_mbedtls) diff --git a/py/usermod.cmake b/py/usermod.cmake index 4a8b99ff31b46..e57979e1df080 100644 --- a/py/usermod.cmake +++ b/py/usermod.cmake @@ -9,10 +9,12 @@ function(usermod_gather_sources SOURCES_VARNAME INCLUDE_DIRECTORIES_VARNAME INCL return() endif() - # Gather library sources + # Gather library sources, then clear them from the target to prevent + # double compilation when the port also links this INTERFACE library. get_target_property(lib_sources ${LIB} INTERFACE_SOURCES) if (lib_sources) list(APPEND ${SOURCES_VARNAME} ${lib_sources}) + set_target_properties(${LIB} PROPERTIES INTERFACE_SOURCES "") endif() # Gather library includes