blob: 3b0097deb763e71789e2a53b5918a1925056d39b [file] [log] [blame]
James Feist6579c762019-06-13 10:45:00 -07001cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
Ed Tanous383fb7b2019-02-11 11:22:30 -08002
James Feist6579c762019-06-13 10:45:00 -07003add_definitions (-DMCTP_LOG_STDERR)
James Feistcc0edda2019-12-09 15:03:25 -08004add_definitions (-DMCTP_HAVE_FILEIO)
Andrew Jeffery682232e2020-01-13 16:17:45 +10305add_definitions (-DMCTP_HAVE_STDIO)
James Feist9c99af22020-01-28 11:45:34 -08006add_definitions (-DMCTP_DEFAULT_ALLOC)
Ed Tanous383fb7b2019-02-11 11:22:30 -08007
Andrew Jeffery2cda40f2020-02-28 15:26:20 +10308add_library (mctp STATIC alloc.c astlpc.c core.c log.c libmctp.h serial.c)
Ed Tanous383fb7b2019-02-11 11:22:30 -08009
Andrew Jeffery8e436af2020-02-28 14:33:42 +103010target_include_directories (mctp PUBLIC
James Feist6579c762019-06-13 10:45:00 -070011 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
12 $<INSTALL_INTERFACE:include/libmctp)
Ed Tanous383fb7b2019-02-11 11:22:30 -080013
James Feist6579c762019-06-13 10:45:00 -070014enable_testing ()
Ed Tanous383fb7b2019-02-11 11:22:30 -080015
James Feist6579c762019-06-13 10:45:00 -070016add_executable (test_eid tests/test_eid.c tests/test-utils.c)
Andrew Jeffery8e436af2020-02-28 14:33:42 +103017target_link_libraries (test_eid mctp)
Andrew Jeffery56c6ff12020-02-28 14:43:42 +103018add_test (NAME eid COMMAND test_eid)
Ed Tanous383fb7b2019-02-11 11:22:30 -080019
James Feist6579c762019-06-13 10:45:00 -070020add_executable (test_seq tests/test_seq.c tests/test-utils.c)
Andrew Jeffery8e436af2020-02-28 14:33:42 +103021target_link_libraries (test_seq mctp)
Andrew Jeffery56c6ff12020-02-28 14:43:42 +103022add_test (NAME seq COMMAND test_seq)
Ed Tanous383fb7b2019-02-11 11:22:30 -080023
Andrew Jeffery2cda40f2020-02-28 15:26:20 +103024add_executable (test_bridge tests/test_bridge.c tests/test-utils.c)
25target_link_libraries (test_bridge mctp)
26add_test (NAME bridge COMMAND test_bridge)
27
28add_executable (test_astlpc tests/test_astlpc.c tests/test-utils.c)
29target_link_libraries (test_astlpc mctp)
30add_test (NAME astlpc COMMAND test_astlpc)
31
32add_executable (test_serial tests/test_serial.c tests/test-utils.c)
33target_link_libraries (test_serial mctp)
34add_test (NAME serial COMMAND test_serial)
35
Wiktor GoĊ‚gowskiba6727e2020-03-13 18:25:01 +010036add_executable (test_cmds tests/test_cmds.c tests/test-utils.c)
37target_link_libraries (test_cmds mctp)
38add_test (NAME control_commands COMMAND test_cmds)
39
Andrew Jeffery8e436af2020-02-28 14:33:42 +103040install (TARGETS mctp DESTINATION lib)
James Feist6579c762019-06-13 10:45:00 -070041install (FILES libmctp.h DESTINATION include)
42