drivers: sensor: fix cmake empty library warning
When there is no sensor driver enabled, cmake warns that the library has no sources. Fix that by wrapping cmake library instructions inside kconfig. Fixes #37765 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
4c3a023a0c
commit
e4da47ca8f
1 changed files with 6 additions and 0 deletions
|
@ -96,7 +96,13 @@ add_subdirectory_ifdef(CONFIG_ITDS wsen_itds)
|
|||
add_subdirectory_ifdef(CONFIG_MCUX_ACMP mcux_acmp)
|
||||
add_subdirectory_ifdef(CONFIG_TACH_NPCX nuvoton_tach_npcx)
|
||||
|
||||
if(CONFIG_USERSPACE OR CONFIG_SENSOR_SHELL OR CONFIG_SENSOR_SHELL_BATTERY)
|
||||
# The above if() is needed or else CMake would complain about
|
||||
# empty library.
|
||||
|
||||
zephyr_library()
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE sensor_handlers.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_SENSOR_SHELL sensor_shell.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_SENSOR_SHELL_BATTERY shell_battery.c)
|
||||
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue