pkgconfig
This commit is contained in:
parent
6ff604dd38
commit
31f903ba3e
@ -1,24 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(libtopo)
|
||||
project(bsdtopo)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(LIBVER 1.1.0)
|
||||
|
||||
pkg_check_modules(XML libxml-2.0 REQUIRED)
|
||||
set(C_FLAGS -O2 -g -Wall -Wextra -Werror -Wpedantic -Wconversion -std=c17
|
||||
-march=native)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/inc)
|
||||
|
||||
add_library(topo SHARED topo.c timestamp.c)
|
||||
target_compile_options(topo PRIVATE ${C_FLAGS} ${XML_CFLAGS})
|
||||
target_include_directories(topo PRIVATE ${XML_INCLUDE_DIRS})
|
||||
target_link_libraries(topo PRIVATE ${XML_LINK_LIBRARIES})
|
||||
add_library(bsdtopo SHARED topo.c timestamp.c)
|
||||
target_compile_options(bsdtopo PRIVATE ${C_FLAGS} ${XML_CFLAGS})
|
||||
target_include_directories(bsdtopo PRIVATE ${XML_INCLUDE_DIRS})
|
||||
target_link_libraries(bsdtopo PRIVATE ${XML_LINK_LIBRARIES})
|
||||
|
||||
add_executable(test test/test.c)
|
||||
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)
|
||||
target_link_libraries(test PRIVATE topo)
|
||||
target_link_libraries(test PRIVATE bsdtopo)
|
||||
target_compile_options(test PRIVATE ${C_FLAGS})
|
||||
|
||||
install(TARGETS topo DESTINATION lib/libtopo)
|
||||
install(FILES inc/topo.h DESTINATION include/libtopo)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bsdtopo.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/bsdtopo.pc
|
||||
@ONLY
|
||||
)
|
||||
install(TARGETS bsdtopo DESTINATION lib/bsdtopo)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/inc/topo.h DESTINATION include/bsdtopo)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bsdtopo.pc DESTINATION libdata/pkgconfig)
|
10
bsdtopo.pc.in
Normal file
10
bsdtopo.pc.in
Normal file
@ -0,0 +1,10 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include/bsdtopo
|
||||
libdir=${exec_prefix}/lib/bsdtopo
|
||||
|
||||
Name: bsdtopo
|
||||
Description: A FreeBSD topology library
|
||||
Version: @LIBVER@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lbsdtopo
|
Loading…
Reference in New Issue
Block a user