CMakeLists.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. cmake_minimum_required(VERSION 2.8)
  2. cmake_policy(SET CMP0015 NEW)
  3. # Project Definition
  4. project(odhcp6c C)
  5. set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  6. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3 -std=c99")
  7. add_definitions(-D_GNU_SOURCE -Os -Wall -Werror -pedantic)
  8. IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
  9. add_definitions(-Wextra -Werror=implicit-function-declaration)
  10. add_definitions(-Wformat -Werror=format-security -Werror=format-nonliteral)
  11. ENDIF()
  12. add_definitions(-Wno-unused-parameter -Wmissing-declarations)
  13. if(${EXT_PREFIX_CLASS})
  14. add_definitions(-DEXT_PREFIX_CLASS=${EXT_PREFIX_CLASS})
  15. endif(${EXT_PREFIX_CLASS})
  16. if(${EXT_CER_ID})
  17. add_definitions(-DEXT_CER_ID=${EXT_CER_ID})
  18. endif(${EXT_CER_ID})
  19. set(SOURCES src/odhcp6c.c src/dhcpv6.c src/ra.c src/script.c)
  20. set(LIBRARIES resolv)
  21. if(USE_LIBUBOX)
  22. add_definitions(-DUSE_LIBUBOX)
  23. set(LIBRARIES ${LIBRARIES} ubox)
  24. FIND_PATH(ubox_include_dir libubox/md5.h)
  25. INCLUDE_DIRECTORIES(${ubox_include_dir})
  26. else()
  27. set(SOURCES ${SOURCES} src/md5.c)
  28. endif()
  29. add_executable(odhcp6c ${SOURCES})
  30. target_link_libraries(odhcp6c ${LIBRARIES})
  31. # Installation
  32. install(TARGETS odhcp6c DESTINATION sbin/)
  33. # Packaging information
  34. set(CPACK_PACKAGE_VERSION "1")
  35. set(CPACK_PACKAGE_CONTACT "Steven Barth <steven@midlink.org>")
  36. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "6ac")
  37. set(CPACK_GENERATOR "DEB;RPM;STGZ")
  38. set(CPACK_STRIP_FILES true)
  39. SET(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
  40. set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}")
  41. include(CPack)