Skip to content

Commit c76697e

Browse files
committed
Fix module compilation warning
When CONFIG_MCTP was not set the library sources would be empty and result in a CMake warning. Wrap entire CMake file in an if(CONFIG_MCTP) to ensure nothing is done when CONFIG_MCTP is not set. Signed-off-by: Tom Burdick <[email protected]>
1 parent fa15266 commit c76697e

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

zephyr/CMakeLists.txt

+17-15
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

5-
set(MCTP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/..)
5+
if(CONFIG_MCTP)
6+
set(MCTP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/..)
67

7-
zephyr_interface_library_named(mctp)
8-
target_link_libraries(zephyr_interface INTERFACE mctp)
9-
target_include_directories(mctp INTERFACE ${MCTP_SRC})
8+
zephyr_interface_library_named(mctp)
9+
target_link_libraries(zephyr_interface INTERFACE mctp)
10+
target_include_directories(mctp INTERFACE ${MCTP_SRC})
1011

11-
zephyr_library_named(modules_mctp)
12-
zephyr_library_link_libraries(mctp)
12+
zephyr_library_named(modules_mctp)
13+
zephyr_library_link_libraries(mctp)
1314

14-
zephyr_library_sources_ifdef(
15-
CONFIG_MCTP
16-
${MCTP_SRC}/alloc.c
17-
${MCTP_SRC}/crc32.c
18-
${MCTP_SRC}/core.c
19-
${MCTP_SRC}/log.c
20-
${MCTP_SRC}/libmctp.h
21-
${MCTP_SRC}/crc-16-ccitt.c
22-
)
15+
zephyr_library_sources_ifdef(
16+
CONFIG_MCTP
17+
${MCTP_SRC}/alloc.c
18+
${MCTP_SRC}/crc32.c
19+
${MCTP_SRC}/core.c
20+
${MCTP_SRC}/log.c
21+
${MCTP_SRC}/libmctp.h
22+
${MCTP_SRC}/crc-16-ccitt.c
23+
)
24+
endif()

0 commit comments

Comments
 (0)