CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
  2. PROJECT(libnl-tiny C)
  3. INCLUDE(GNUInstallDirs)
  4. INCLUDE_DIRECTORIES(include)
  5. ADD_DEFINITIONS(-Wall -Werror -Wextra -Wno-unused-parameter)
  6. STRING(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
  7. SET(SOURCES
  8. attr.c
  9. cache.c
  10. cache_mngt.c
  11. error.c
  12. genl.c
  13. genl_ctrl.c
  14. genl_family.c
  15. genl_mngt.c
  16. handlers.c
  17. msg.c
  18. nl.c
  19. object.c
  20. socket.c
  21. unl.c
  22. )
  23. SET(SOVERSION 1 CACHE STRING "Override libnl-tiny library version")
  24. ADD_LIBRARY(nl-tiny SHARED ${SOURCES})
  25. SET_TARGET_PROPERTIES(nl-tiny PROPERTIES SOVERSION ${SOVERSION})
  26. ADD_LIBRARY(nl-tiny-static STATIC ${SOURCES})
  27. SET_TARGET_PROPERTIES(nl-tiny-static PROPERTIES OUTPUT_NAME nl-tiny)
  28. CONFIGURE_FILE(
  29. "${CMAKE_CURRENT_SOURCE_DIR}/libnl-tiny.pc.in"
  30. "${CMAKE_CURRENT_BINARY_DIR}/libnl-tiny.pc"
  31. @ONLY
  32. )
  33. INSTALL(TARGETS nl-tiny nl-tiny-static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
  34. INSTALL(FILES ${CMAKE_BINARY_DIR}/libnl-tiny.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
  35. INSTALL(
  36. DIRECTORY ${CMAKE_SOURCE_DIR}/include/
  37. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libnl-tiny
  38. FILES_MATCHING PATTERN "*.h"
  39. )