You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.0 KiB

  1. cmake_minimum_required(VERSION 2.6)
  2. PROJECT(nginx-util CXX)
  3. SET(CMAKE_CXX_STANDARD 17)
  4. INCLUDE(CheckFunctionExists)
  5. IF(UBUS)
  6. FIND_PATH(ubus_include_dir libubus.h)
  7. FIND_LIBRARY(ubox NAMES ubox)
  8. FIND_LIBRARY(ubus NAMES ubus)
  9. INCLUDE_DIRECTORIES(${ubus_include_dir})
  10. ENDIF()
  11. ADD_DEFINITIONS(-Os -Wall -Werror -Wextra -g3)
  12. ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
  13. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  14. IF(UBUS)
  15. ADD_COMPILE_DEFINITIONS(VERSION=${VERSION})
  16. ADD_EXECUTABLE(nginx-util nginx-util.cpp)
  17. TARGET_COMPILE_DEFINITIONS(nginx-util PUBLIC -DNO_SSL)
  18. TARGET_LINK_LIBRARIES(nginx-util ${ubox} ${ubus} pthread)
  19. INSTALL(TARGETS nginx-util RUNTIME DESTINATION bin)
  20. ADD_EXECUTABLE(nginx-ssl-util nginx-util.cpp)
  21. TARGET_LINK_LIBRARIES(nginx-ssl-util ${ubox} ${ubus} pthread ssl crypto pcre)
  22. INSTALL(TARGETS nginx-ssl-util RUNTIME DESTINATION bin)
  23. ADD_EXECUTABLE(nginx-ssl-util-nopcre nginx-util.cpp)
  24. TARGET_COMPILE_DEFINITIONS(nginx-ssl-util-nopcre PUBLIC -DNO_PCRE)
  25. TARGET_LINK_LIBRARIES(nginx-ssl-util-nopcre ${ubox} ${ubus} pthread ssl crypto)
  26. INSTALL(TARGETS nginx-ssl-util-nopcre RUNTIME DESTINATION bin)
  27. ELSE()
  28. CONFIGURE_FILE(test-px5g.sh test-px5g.sh COPYONLY)
  29. CONFIGURE_FILE(test-nginx-util.sh test-nginx-util.sh COPYONLY)
  30. CONFIGURE_FILE(test-nginx-util-root.sh test-nginx-util-root.sh COPYONLY)
  31. ADD_EXECUTABLE(px5g px5g.cpp)
  32. TARGET_LINK_LIBRARIES(px5g ssl crypto)
  33. INSTALL(TARGETS px5g RUNTIME DESTINATION bin)
  34. ADD_EXECUTABLE(nginx-ssl-util-noubus nginx-util.cpp)
  35. TARGET_COMPILE_DEFINITIONS(nginx-ssl-util-noubus PUBLIC -DNO_UBUS)
  36. TARGET_LINK_LIBRARIES(nginx-ssl-util-noubus pthread ssl crypto pcre)
  37. INSTALL(TARGETS nginx-ssl-util-noubus RUNTIME DESTINATION bin)
  38. ADD_EXECUTABLE(nginx-ssl-util-nopcre-noubus nginx-util.cpp)
  39. TARGET_COMPILE_DEFINITIONS(nginx-ssl-util-nopcre-noubus PUBLIC -DNO_PCRE -DNO_UBUS)
  40. TARGET_LINK_LIBRARIES(nginx-ssl-util-nopcre-noubus pthread ssl crypto)
  41. INSTALL(TARGETS nginx-ssl-util-nopcre-noubus RUNTIME DESTINATION bin)
  42. ENDIF()