Files
engine/CMakeLists.txt
T

52 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(SFML_game_engine)
include_directories(include)
set(SOURCES
src/main.cpp
src/elements.cpp
src/maps.cpp
)
include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 3.0.2
GIT_SHALLOW ON
EXCLUDE_FROM_ALL
SYSTEM)
FetchContent_MakeAvailable(SFML)
# Detect macOS
if(APPLE)
message(STATUS "Detected macOS — using range-v3 for cartesian_product")
include(FetchContent)
FetchContent_Declare(
range-v3
GIT_REPOSITORY https://github.com/ericniebler/range-v3.git
GIT_TAG 0.12.0
GIT_SHALLOW ON
)
FetchContent_MakeAvailable(range-v3)
# Add include directory globally or per target
include_directories(${range-v3_SOURCE_DIR}/include)
# Optional: expose a macro so you can #ifdef it in code
add_compile_definitions(USE_RANGE_V3)
else()
message(STATUS "Non-macOS system — assuming std::views::cartesian_product is available")
endif()
add_executable(SFML_game_engine ${SOURCES})
target_link_libraries(SFML_game_engine
PRIVATE
SFML::Graphics
SFML::Window
SFML::System
)