Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

44 Zeilen
1.4 KiB

  1. cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
  2. project(example)
  3. # Set this to the minimal version you want to support
  4. find_package(raylib 3.0 QUIET) # Let CMake search for a raylib-config.cmake
  5. # You could change the QUIET above to REQUIRED and remove this if() clause
  6. # This part downloads raylib and builds it if it's not installed on your system
  7. if (NOT raylib_FOUND) # If there's none, fetch and build raylib
  8. include(FetchContent)
  9. FetchContent_Declare(
  10. raylib
  11. URL https://github.com/raysan5/raylib/archive/master.tar.gz
  12. )
  13. FetchContent_GetProperties(raylib)
  14. if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
  15. set(FETCHCONTENT_QUIET NO)
  16. FetchContent_Populate(raylib)
  17. set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
  18. # build raylib
  19. add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
  20. endif()
  21. endif()
  22. # This is the main part:
  23. add_executable(${PROJECT_NAME} core_basic_window.c)
  24. #set(raylib_VERBOSE 1)
  25. target_link_libraries(${PROJECT_NAME} raylib)
  26. # Checks if OSX and links appropriate frameworks (Only required on MacOS)
  27. if (APPLE)
  28. target_link_libraries(${PROJECT_NAME} "-framework IOKit")
  29. target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
  30. target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
  31. endif()
  32. # That's it! You should have an example executable that you can run. Have fun!