mirror of
https://github.com/allankoechke/raylib-cpp.git
synced 2026-12-01 09:24:33 +00:00
Update CMake template (#169)
This commit is contained in:
1
projects/CMake/.gitignore
vendored
Normal file
1
projects/CMake/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -1,24 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(raylib_cpp_example)
|
||||
|
||||
# raylib
|
||||
find_package(raylib QUIET)
|
||||
if (NOT raylib_FOUND)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
||||
GIT_TAG 4.0.0
|
||||
)
|
||||
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)
|
||||
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
||||
endif()
|
||||
FetchContent_MakeAvailable(raylib)
|
||||
endif()
|
||||
|
||||
# raylib-cpp
|
||||
@@ -28,20 +20,14 @@ if (NOT raylib_cpp_FOUND)
|
||||
FetchContent_Declare(
|
||||
raylib_cpp
|
||||
GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git
|
||||
GIT_TAG v4.0.4
|
||||
GIT_TAG v4.1.0
|
||||
)
|
||||
FetchContent_GetProperties(raylib_cpp)
|
||||
if (NOT raylib_cpp_POPULATED) # Have we downloaded raylib-cpp yet?
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_Populate(raylib_cpp)
|
||||
add_subdirectory(${raylib_cpp_SOURCE_DIR} ${raylib_cpp_BINARY_DIR})
|
||||
endif()
|
||||
FetchContent_MakeAvailable(raylib_cpp)
|
||||
endif()
|
||||
|
||||
# This is the main part:
|
||||
set(PROJECT_NAME raylib_cpp_example)
|
||||
set(PROJECT_SOURCES main.cpp)
|
||||
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
|
||||
set(SOURCES main.cpp)
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC raylib raylib_cpp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user