CMakeLists.txt 974 B

123456789101112131415161718192021222324252627282930313233343536
  1. cmake_minimum_required(VERSION 2.6)
  2. PROJECT(urngd)
  3. INCLUDE(GNUInstallDirs)
  4. INCLUDE (FindPkgConfig)
  5. SET(URNGD_VERSION 1.0.2)
  6. SET(JTEN_DIR 3rdparty/jitterentropy-rngd)
  7. FIND_PATH(ubox_include_dir NAMES libubox/usock.h)
  8. FIND_LIBRARY(ubox NAMES ubox)
  9. INCLUDE_DIRECTORIES(${ubox_include_dir} ${JTEN_DIR})
  10. SET(CMAKE_C_FLAGS_DEBUG -DURNGD_DEBUG)
  11. ADD_DEFINITIONS(-Wall -Werror -Wextra --std=gnu99 -DURNGD_VERSION="${URNGD_VERSION}")
  12. ADD_DEFINITIONS(-Wno-unused-parameter)
  13. ADD_EXECUTABLE(urngd
  14. urngd.c
  15. ${JTEN_DIR}/jitterentropy-base.c
  16. )
  17. TARGET_LINK_LIBRARIES(urngd ${ubox})
  18. # jitter RNG must not be compiled with optimizations, _FORTIFY_SOURCE needs optimizations
  19. SET_PROPERTY(
  20. SOURCE ${JTEN_DIR}/jitterentropy-base.c
  21. APPEND PROPERTY COMPILE_OPTIONS -U_FORTIFY_SOURCE -O0
  22. )
  23. INSTALL(TARGETS urngd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
  24. SET(REMOTE_ADDR 192.168.1.20)
  25. ADD_CUSTOM_TARGET(upload
  26. COMMAND scp ${CMAKE_BINARY_DIR}/urngd root@${REMOTE_ADDR}:/usr/sbin
  27. )