diff options
Diffstat (limited to 'examples/usercmodule/cexample/micropython.cmake')
-rw-r--r-- | examples/usercmodule/cexample/micropython.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/usercmodule/cexample/micropython.cmake b/examples/usercmodule/cexample/micropython.cmake new file mode 100644 index 000000000..371a3eefa --- /dev/null +++ b/examples/usercmodule/cexample/micropython.cmake @@ -0,0 +1,21 @@ +# Create an INTERFACE library for our C module. +add_library(usermod_cexample INTERFACE) + +# Add our source files to the lib +target_sources(usermod_cexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/examplemodule.c +) + +# Add the current directory as an include directory. +target_include_directories(usermod_cexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR} +) + +# Enable the module automatically by adding the relevant compile definitions. +target_compile_definitions(usermod_cexample INTERFACE + MODULE_CEXAMPLE_ENABLED=1 +) + +# Link our INTERFACE library to the usermod target. +target_link_libraries(usermod INTERFACE usermod_cexample) + |