Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

42 lignes
1.4 KiB

  1. cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
  2. project(example)
  3. # Generate compile_commands.json
  4. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  5. # Dependencies
  6. set(RAYLIB_VERSION 5.5)
  7. find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED
  8. if (NOT raylib_FOUND) # If there's none, fetch and build raylib
  9. include(FetchContent)
  10. FetchContent_Declare(
  11. raylib
  12. DOWNLOAD_EXTRACT_TIMESTAMP OFF
  13. URL https://github.com/raysan5/raylib/archive/refs/tags/${RAYLIB_VERSION}.tar.gz
  14. )
  15. FetchContent_GetProperties(raylib)
  16. if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
  17. set(FETCHCONTENT_QUIET NO)
  18. FetchContent_MakeAvailable(raylib)
  19. set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
  20. endif()
  21. endif()
  22. # Our Project
  23. add_executable(${PROJECT_NAME} core_basic_window.c)
  24. #set(raylib_VERBOSE 1)
  25. target_link_libraries(${PROJECT_NAME} raylib)
  26. # Web Configurations
  27. if (${PLATFORM} STREQUAL "Web")
  28. # Tell Emscripten to build an example.html file.
  29. set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
  30. endif()
  31. # Checks if OSX and links appropriate frameworks (Only required on MacOS)
  32. if (APPLE)
  33. target_link_libraries(${PROJECT_NAME} "-framework IOKit")
  34. target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
  35. target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
  36. endif()