libtopo/CMakeLists.txt

24 lines
850 B
CMake
Raw Normal View History

2022-05-26 16:25:30 +00:00
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)
2022-06-10 11:29:01 +00:00
set(C_FLAGS -O2 -g -Wall -Wextra -Werror -Wpedantic -Wconversion -std=c17
2022-05-26 16:25:30 +00:00
-march=native)
include_directories(${CMAKE_SOURCE_DIR}/inc)
2022-06-10 11:29:01 +00:00
add_library(topo SHARED topo.c timestamp.c)
2022-05-26 16:25:30 +00:00
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})
2022-05-26 16:36:03 +00:00
add_executable(test test/test.c)
2022-05-26 16:25:30 +00:00
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)