libbsock/CMakeLists.txt

29 lines
1.1 KiB
CMake
Raw Normal View History

2023-01-17 12:46:42 +01:00
cmake_minimum_required(VERSION 3.10.0)
project(bsock C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2023-03-05 14:51:24 +01:00
set(CFLAGS -Wall -Wextra -Werror -std=c17 -march=native -O3 -g -DNDEBUG)
set(CFLAGS_DBG -Wall -Wextra -Werror -std=c17 -march=native -Og -g)
set(LIBVER 1.1.0)
2023-01-17 12:46:42 +01:00
add_library(bsock SHARED bsock.c ringbuf.c)
target_compile_options(bsock PRIVATE ${CFLAGS})
target_include_directories(bsock PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
2023-03-05 14:51:24 +01:00
add_library(bsock_debug SHARED bsock.c ringbuf.c)
target_compile_options(bsock_debug PRIVATE ${CFLAGS_DBG})
target_include_directories(bsock_debug PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
2023-01-17 12:46:42 +01:00
add_executable(test test.c)
2023-03-05 14:51:24 +01:00
target_link_libraries(test PRIVATE bsock_debug)
target_compile_options(test PRIVATE ${CFLAGS_DBG})
2023-01-17 12:46:42 +01:00
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/bsock.pc.in
${CMAKE_CURRENT_BINARY_DIR}/bsock.pc
@ONLY
)
install(TARGETS bsock DESTINATION lib/bsock)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bsock.h DESTINATION include/bsock)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ringbuf.h DESTINATION include/bsock)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bsock.pc DESTINATION libdata/pkgconfig)