A Mastodon bot that expands shortened URLs.
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
1.9KB

  1. cmake_minimum_required (VERSION 3.7)
  2. project (expandurl-mastodon
  3. VERSION 0.9.14
  4. LANGUAGES CXX
  5. )
  6. include(GNUInstallDirs)
  7. find_package(CURL REQUIRED)
  8. find_package(PkgConfig REQUIRED)
  9. pkg_check_modules(CURLPP REQUIRED curlpp)
  10. pkg_check_modules(JSONCPP REQUIRED jsoncpp)
  11. pkg_check_modules(LIBXDG_BASEDIR REQUIRED libxdg-basedir)
  12. set(CMAKE_CXX_STANDARD 14)
  13. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  14. set(CMAKE_CXX_EXTENSIONS OFF)
  15. set(CMAKE_CXX_FLAGS_DEBUG
  16. "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wpedantic -ftrapv \
  17. -fsanitize=undefined -g -Og -fno-omit-frame-pointer")
  18. include_directories(${PROJECT_BINARY_DIR})
  19. include_directories(${CURL_INCLUDE_DIRS})
  20. include_directories(${CURLPP_INCLUDE_DIRS})
  21. include_directories(${JSONCPP_INCLUDE_DIRS})
  22. include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
  23. link_directories(${CURL_LIBRARY_DIRS})
  24. link_directories(${CURLPP_LIBRARY_DIRS})
  25. link_directories(${JSONCPP_LIBRARY_DIRS})
  26. link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
  27. # Write version in header
  28. configure_file (
  29. "${PROJECT_SOURCE_DIR}/src/version.hpp.in"
  30. "${PROJECT_BINARY_DIR}/version.hpp"
  31. )
  32. file(GLOB sources src/*.cpp)
  33. add_executable(expandurl-mastodon ${sources})
  34. target_link_libraries(expandurl-mastodon
  35. ${CURLPP_LIBRARIES} ${JSONCPP_LIBRARIES} ${LIBXDG_BASEDIR_LIBRARIES}
  36. mastodon-cpp pthread stdc++fs)
  37. install(TARGETS expandurl-mastodon DESTINATION ${CMAKE_INSTALL_BINDIR})
  38. set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
  39. if (WITH_MAN)
  40. add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1"
  41. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
  42. DEPENDS "${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.1.adoc"
  43. COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
  44. ARGS ${PROJECT_VERSION})
  45. add_custom_target(run ALL
  46. DEPENDS "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1")
  47. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
  48. DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
  49. endif()