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.

CMakeLists.txt 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
  16. if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
  17. # uint_fast16_t can be bigger than 16 bit, but that doesn't matter because
  18. # everything but the last 16 bit is padded with zeroes.
  19. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format")
  20. endif()
  21. include_directories(${PROJECT_SOURCE_DIR}/src)
  22. include_directories(${PROJECT_BINARY_DIR})
  23. include_directories(${CURL_INCLUDE_DIRS})
  24. include_directories(${CURLPP_INCLUDE_DIRS})
  25. include_directories(${JSONCPP_INCLUDE_DIRS})
  26. include_directories(${LIBXDG_BASEDIR_INCLUDE_DIRS})
  27. link_directories(${CURL_LIBRARY_DIRS})
  28. link_directories(${CURLPP_LIBRARY_DIRS})
  29. link_directories(${JSONCPP_LIBRARY_DIRS})
  30. link_directories(${LIBXDG_BASEDIR_LIBRARY_DIRS})
  31. # Write version in header
  32. configure_file (
  33. "${PROJECT_SOURCE_DIR}/src/version.hpp.in"
  34. "${PROJECT_BINARY_DIR}/version.hpp"
  35. )
  36. file(GLOB sources src/*.cpp)
  37. add_executable(expandurl-mastodon ${sources})
  38. target_link_libraries(expandurl-mastodon
  39. ${CURLPP_LIBRARIES} ${JSONCPP_LIBRARIES}
  40. ${LIBXDG_BASEDIR_LIBRARIES} mastodon-cpp pthread stdc++fs)
  41. install(TARGETS expandurl-mastodon DESTINATION ${CMAKE_INSTALL_BINDIR})
  42. set(WITH_MAN "YES" CACHE STRING "WITH_MAN defaults to \"YES\"")
  43. if (WITH_MAN)
  44. add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1"
  45. WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
  46. DEPENDS "${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.1.adoc"
  47. COMMAND ${CMAKE_SOURCE_DIR}/build_manpage.sh
  48. ARGS ${PROJECT_VERSION})
  49. add_custom_target(run ALL
  50. DEPENDS "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1")
  51. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.1
  52. DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
  53. endif()