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.

57 lines
1.9 KiB

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