Skip to content

Commit e336eba

Browse files
raiden00plcederom
authored andcommitted
cmake: fix cmake build for FreeModBus
fix cmake build for FreeModBus: 1. nuttx-apps/modbus/mb.c:50:12: fatal error: mbrtu.h: No such file or directory 50 | # include "mbrtu.h" 2. nuttx-apps/modbus/functions/mbutils.c:41:10: fatal error: port.h: No such file or directory 41 | #include "port.h" 3. various "undefined reference to" errors Signed-off-by: raiden00pl <[email protected]>
1 parent 9e2775d commit e336eba

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modbus/CMakeLists.txt

+9-4
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,27 @@ if(CONFIG_MODBUS)
7575
# rtu/Make.defs
7676

7777
if(CONFIG_MB_RTU_ENABLED OR CONFIG_MB_RTU_MASTER)
78-
list(APPEND rtu/mbcrc.c)
78+
list(APPEND CSRCS rtu/mbcrc.c)
7979
if(CONFIG_MB_RTU_ENABLED)
80-
list(APPEND rtu/mbrtu.c)
80+
list(APPEND CSRCS rtu/mbrtu.c)
8181
endif()
8282

8383
if(CONFIG_MB_RTU_MASTER)
84-
list(APPEND rtu/mbrtu_m.c)
84+
list(APPEND CSRCS rtu/mbrtu_m.c)
8585
endif()
8686
endif()
8787

8888
# tcp/Make.defs
8989

9090
if(CONFIG_MB_TCP_ENABLED)
91-
list(APPEND tcp/mbtcp.c)
91+
list(APPEND CSRCS tcp/mbtcp.c)
9292
endif()
9393

94+
# include private headers
95+
96+
target_include_directories(apps PRIVATE nuttx)
97+
target_include_directories(apps PRIVATE rtu)
98+
9499
target_sources(apps PRIVATE ${CSRCS})
95100

96101
endif()

0 commit comments

Comments
 (0)