Discord library in plain C
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CMakeLists.txt 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. cmake_minimum_required(VERSION 3.12)
  2. project(libdiscord C)
  3. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
  4. option(EXAMPLES "Build examples" ON)
  5. # Get the current working branch
  6. execute_process(
  7. COMMAND git rev-parse --abbrev-ref HEAD
  8. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  9. OUTPUT_VARIABLE GIT_BRANCH
  10. OUTPUT_STRIP_TRAILING_WHITESPACE
  11. )
  12. # Get the latest abbreviated commit hash of the working branch
  13. execute_process(
  14. COMMAND git log -1 --format=%h
  15. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  16. OUTPUT_VARIABLE GIT_COMMIT_HASH
  17. OUTPUT_STRIP_TRAILING_WHITESPACE
  18. )
  19. add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
  20. add_definitions("-DGIT_BRANCH=${GIT_BRANCH}")
  21. include_directories(include)
  22. find_package(CURL)
  23. if(NOT CURL_FOUND)
  24. message(SEND_ERROR "Failed to find CURL")
  25. return()
  26. else()
  27. include_directories(${CURL_INCLUDE_DIR})
  28. endif()
  29. find_package(Jansson)
  30. if (NOT JANSSON_FOUND)
  31. message(SEND_ERROR "Failed to find Jansson")
  32. return()
  33. else()
  34. include_directories(${JANSSON_INCLUDE_DIRS})
  35. endif()
  36. set(CMAKE_C_STANDARD 99)
  37. add_library(discord lib/discord.c include/discord.h lib/rest.c lib/requests.c include/requests.h lib/log.c include/log.h lib/utils.c)
  38. target_link_libraries(discord ${JANSSON_LIBRARIES} ${CURL_LIBRARIES})
  39. if (EXAMPLES)
  40. add_subdirectory(examples)
  41. endif()