28 lines
988 B
CMake
28 lines
988 B
CMake
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(libtopo)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
pkg_check_modules(XML libxml-2.0 REQUIRED)
|
|
set(C_FLAGS -O2 -g -Wall -Wextra -Werror -std=c17
|
|
-Wno-deprecated-declarations
|
|
-Wno-address-of-packed-member
|
|
-Wno-zero-length-array
|
|
-Wno-gnu-zero-variadic-macro-arguments
|
|
-march=native)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/inc)
|
|
|
|
add_library(topo SHARED topo.c alloc.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_executable(test test/test.c)
|
|
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)
|
|
target_link_libraries(test PRIVATE topo)
|
|
target_compile_options(test PRIVATE ${C_FLAGS})
|
|
|
|
install(TARGETS topo DESTINATION lib/libtopo)
|
|
install(FILES inc/topo.h DESTINATION include/libtopo) |