1383fb7b7SEd Tanouscmake_minimum_required (VERSION 3.5 FATAL_ERROR) 2383fb7b7SEd Tanous 3cfeaef8eSSumanth Bhatoption(DEV "Option for developer testing" OFF) 4cfeaef8eSSumanth Bhat 5cfeaef8eSSumanth Bhatif(DEV) 6cfeaef8eSSumanth Bhat set(CMAKE_C_FLAGS 7cfeaef8eSSumanth Bhat "${CMAKE_C_FLAGS} \ 8cfeaef8eSSumanth Bhat -Werror \ 9cfeaef8eSSumanth Bhat -Wall \ 10cfeaef8eSSumanth Bhat -Wextra \ 11cfeaef8eSSumanth Bhat -Wnull-dereference \ 12cfeaef8eSSumanth Bhat -Wformat-security \ 13cfeaef8eSSumanth Bhat -Wno-type-limits \ 14cfeaef8eSSumanth Bhat -fsanitize=address,leak,undefined \ 15cfeaef8eSSumanth Bhat -ggdb \ 16cfeaef8eSSumanth Bhat ") 17cfeaef8eSSumanth Bhatendif() 18cfeaef8eSSumanth Bhat 19cfeaef8eSSumanth Bhat 20383fb7b7SEd Tanousadd_definitions (-DMCTP_LOG_STDERR) 21cc0eddaaSJames Feistadd_definitions (-DMCTP_HAVE_FILEIO) 22682232eaSAndrew Jefferyadd_definitions (-DMCTP_HAVE_STDIO) 239c99af2bSJames Feistadd_definitions (-DMCTP_DEFAULT_ALLOC) 24383fb7b7SEd Tanous 25*b3de343eSJohn Chungadd_library (mctp STATIC alloc.c astlpc.c crc32.c core.c log.c libmctp.h serial.c crc-16-ccitt.c) 26383fb7b7SEd Tanous 278e436af8SAndrew Jefferytarget_include_directories (mctp PUBLIC 286579c76dSJames Feist $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> 29383fb7b7SEd Tanous $<INSTALL_INTERFACE:include/libmctp) 30383fb7b7SEd Tanous 31383fb7b7SEd Tanousenable_testing () 32383fb7b7SEd Tanous 336579c76dSJames Feistadd_executable (test_eid tests/test_eid.c tests/test-utils.c) 348e436af8SAndrew Jefferytarget_link_libraries (test_eid mctp) 3556c6ff12SAndrew Jefferyadd_test (NAME eid COMMAND test_eid) 36383fb7b7SEd Tanous 376579c76dSJames Feistadd_executable (test_seq tests/test_seq.c tests/test-utils.c) 388e436af8SAndrew Jefferytarget_link_libraries (test_seq mctp) 3956c6ff12SAndrew Jefferyadd_test (NAME seq COMMAND test_seq) 40383fb7b7SEd Tanous 412cda40faSAndrew Jefferyadd_executable (test_bridge tests/test_bridge.c tests/test-utils.c) 422cda40faSAndrew Jefferytarget_link_libraries (test_bridge mctp) 432cda40faSAndrew Jefferyadd_test (NAME bridge COMMAND test_bridge) 442cda40faSAndrew Jeffery 452cda40faSAndrew Jefferyadd_executable (test_astlpc tests/test_astlpc.c tests/test-utils.c) 462cda40faSAndrew Jefferytarget_link_libraries (test_astlpc mctp) 472cda40faSAndrew Jefferyadd_test (NAME astlpc COMMAND test_astlpc) 482cda40faSAndrew Jeffery 492cda40faSAndrew Jefferyadd_executable (test_serial tests/test_serial.c tests/test-utils.c) 502cda40faSAndrew Jefferytarget_link_libraries (test_serial mctp) 512cda40faSAndrew Jefferyadd_test (NAME serial COMMAND test_serial) 522cda40faSAndrew Jeffery 53ba6727e6SWiktor Gołgowskiadd_executable (test_cmds tests/test_cmds.c tests/test-utils.c) 54ba6727e6SWiktor Gołgowskitarget_link_libraries (test_cmds mctp) 55ba6727e6SWiktor Gołgowskiadd_test (NAME control_commands COMMAND test_cmds) 56ba6727e6SWiktor Gołgowski 5769f545f7SSumanth Bhatadd_executable (test_core tests/test_core.c tests/test-utils.c) 5869f545f7SSumanth Bhattarget_link_libraries (test_core mctp) 5969f545f7SSumanth Bhatadd_test (NAME core COMMAND test_core) 6069f545f7SSumanth Bhat 618e436af8SAndrew Jefferyinstall (TARGETS mctp DESTINATION lib) 62383fb7b7SEd Tanousinstall (FILES libmctp.h DESTINATION include) 636579c76dSJames Feist 64