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.

37 lines
1.1 KiB

  1. cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
  2. project(example)
  3. find_package(raylib 2.0 QUIET) # Let CMake search for a raylib-config.cmake
  4. # You could change the QUIET above to REQUIRED and remove this if() clause
  5. # This part downloads raylib and builds it if it's not installed on your system
  6. if (NOT raylib_FOUND) # If there's none, fetch and build raylib
  7. include(FetchContent)
  8. FetchContent_Declare(
  9. raylib
  10. URL https://github.com/raysan5/raylib/archive/master.tar.gz
  11. )
  12. FetchContent_GetProperties(raylib)
  13. if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
  14. set(FETCHCONTENT_QUIET NO)
  15. FetchContent_Populate(raylib)
  16. set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
  17. set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
  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. # That's it! You should have an example executable that you can run. Have fun!