Witch-Game/CMakeLists.txt

52 lines
1.8 KiB
CMake

# Set the minimum version of CMake that can be used
# To find the cmake version run
# $ cmake --version
cmake_minimum_required(VERSION 3.24)
# Set the project name
project(Witch-Game)
#find_package(SDL3 REQUIRED)
#find_package(SDL3_image REQUIRED)
#download SDL if not installed
#use git ls-remote --tags https://github.com/libsdl-org/SDL.git | tail -n 1
#to get the newest git-tag
include(FetchContent)
FetchContent_Declare(
SDL3
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG f6864924f76e1a0b4abaefc76ae2ed22b1a8916e # release-3.2.8
FIND_PACKAGE_ARGS NAMES SDL3
)
FetchContent_Declare(
SDL3_image
GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git
GIT_TAG 11154afb7855293159588b245b446a4ef09e574f # release-3.2.4
FIND_PACKAGE_ARGS NAMES SDL3_image
)
FetchContent_Declare(
SDL3_ttf
GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git
GIT_TAG 3675de381020a719c37f7c79f6564cf52c8f4dcc # release-3.2.0
FIND_PACKAGE_ARGS NAMES SDL3_ttf
)
FetchContent_MakeAvailable(SDL3 SDL3_image SDL3_ttf)
#list all files in Actors folder
set(ACTORS src/Actors/Actor.cpp src/Actors/MovingActor.cpp src/Actors/ActorFactory.cpp)
#set(COMMANDS src/GameCommands/GameCommand.h src/GameCommands/GameCommand.h src/GameCommands/MoveUpCommand.h src/GameCommands/EndGameCommand.h )
set(COMPONENTS src/Components/MoveComponent.cpp )
set(DATA_STRUCTURES src/DataStructures/NormalizedDirection.cpp src/DataStructures/DirectionButtonStatus.cpp)
add_executable(Witch-Game main.cpp src/Game.cpp ${ACTORS} ${COMPONENTS} ${DATA_STRUCTURES})
target_compile_features(Witch-Game PRIVATE cxx_std_17)
target_link_libraries(Witch-Game SDL3 SDL3_image SDL3_ttf)
#set compiler flags for warnings
if(MSVC)
target_compile_options(Witch-Game PRIVATE /W4 /WX)
else()
target_compile_options(Witch-Game PRIVATE -Wall -Wextra -Wpedantic)
endif()