29 lines
1.1 KiB
CMake
29 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.10.0)
|
|
project(bsock C)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
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)
|
|
|
|
add_library(bsock SHARED bsock.c ringbuf.c)
|
|
target_compile_options(bsock PRIVATE ${CFLAGS})
|
|
target_include_directories(bsock PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
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})
|
|
|
|
add_executable(test test.c)
|
|
target_link_libraries(test PRIVATE bsock_debug)
|
|
target_compile_options(test PRIVATE ${CFLAGS_DBG})
|
|
|
|
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) |