aboutsummaryrefslogtreecommitdiff
path: root/raylib/projects/CMake/CMakeLists.txt
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-10-15 21:28:29 -0300
commit1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 (patch)
treef5d692d046868261275c7430a624c3ea9ed75d3d /raylib/projects/CMake/CMakeLists.txt
parenta89f892640cf12f75c7ce18e6e88c70a8d3965ed (diff)
A lot has certainly happened!
Diffstat (limited to 'raylib/projects/CMake/CMakeLists.txt')
-rw-r--r--raylib/projects/CMake/CMakeLists.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/raylib/projects/CMake/CMakeLists.txt b/raylib/projects/CMake/CMakeLists.txt
new file mode 100644
index 0000000..cc606a4
--- /dev/null
+++ b/raylib/projects/CMake/CMakeLists.txt
@@ -0,0 +1,43 @@
+cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
+project(example)
+
+# Generate compile_commands.json
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+# Dependencies
+set(RAYLIB_VERSION 4.5.0)
+find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED
+if (NOT raylib_FOUND) # If there's none, fetch and build raylib
+ include(FetchContent)
+ FetchContent_Declare(
+ raylib
+ DOWNLOAD_EXTRACT_TIMESTAMP OFF
+ URL https://github.com/raysan5/raylib/archive/refs/tags/${RAYLIB_VERSION}.tar.gz
+ )
+ FetchContent_GetProperties(raylib)
+ if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
+ set(FETCHCONTENT_QUIET NO)
+ FetchContent_Populate(raylib)
+ set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
+ add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
+ endif()
+endif()
+
+# Our Project
+
+add_executable(${PROJECT_NAME} core_basic_window.c)
+#set(raylib_VERBOSE 1)
+target_link_libraries(${PROJECT_NAME} raylib)
+
+# Web Configurations
+if (${PLATFORM} STREQUAL "Web")
+ # Tell Emscripten to build an example.html file.
+ set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
+endif()
+
+# Checks if OSX and links appropriate frameworks (Only required on MacOS)
+if (APPLE)
+ target_link_libraries(${PROJECT_NAME} "-framework IOKit")
+ target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
+ target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
+endif() \ No newline at end of file