Skip to content

Commit b97860e

Browse files
kartbenteburd
authored andcommitted
build MCTP zephyr library only when CONFIG_MCTP is enabled
Zephyr does not allow library with no source, which this commit fixes by guarding the entire CMake file behind CONFIG_MCTP. Signed-off-by: Benjamin Cabé <[email protected]>
1 parent fa15266 commit b97860e

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

zephyr/CMakeLists.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# Copyright (c) 2024 Intel Corporation.
2+
# Copyright (c) 2025 The Linux Foundation.
23
#
34
# SPDX-License-Identifier: BSD-3-Clause
45

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

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

11-
zephyr_library_named(modules_mctp)
12-
zephyr_library_link_libraries(mctp)
13+
zephyr_library_named(modules_mctp)
14+
zephyr_library_link_libraries(mctp)
1315

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-
)
16+
zephyr_library_sources(
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)