mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-06 06:49:53 +02:00
CMakeLists.txt: build proper static libraries
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
+18
-7
@@ -64,17 +64,28 @@ if(NOT ANDROID)
|
|||||||
list(APPEND PROGRAMS ${PROGRAMS_J1939})
|
list(APPEND PROGRAMS ${PROGRAMS_J1939})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(can STATIC
|
||||||
|
lib.c
|
||||||
|
canframelen.c
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(j1939 STATIC
|
||||||
|
libj1939.c
|
||||||
|
)
|
||||||
|
|
||||||
foreach(name ${PROGRAMS})
|
foreach(name ${PROGRAMS})
|
||||||
set(SRC_DEPS)
|
add_executable(${name} ${name}.c)
|
||||||
if("${name}" STREQUAL "canbusload")
|
|
||||||
set(SRC_DEPS canframelen.c)
|
if("${name}" IN_LIST PROGRAMS_J1939)
|
||||||
elseif("${name}" IN_LIST PROGRAMS_J1939)
|
target_link_libraries(${name}
|
||||||
set(SRC_DEPS libj1939.c)
|
PRIVATE j1939
|
||||||
|
)
|
||||||
elseif("${name}" IN_LIST PROGRAMS_CANLIB)
|
elseif("${name}" IN_LIST PROGRAMS_CANLIB)
|
||||||
set(SRC_DEPS lib.c)
|
target_link_libraries(${name}
|
||||||
|
PRIVATE can
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(${name} ${name}.c ${SRC_DEPS})
|
|
||||||
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user