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.

46 lines
1.4 KiB

# Check versions message(STATUS "CMake version: ${CMAKE_VERSION}")
cmake_minimum_required(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Set the project name
set(PNAME floppy-bird)
project(${PNAME})
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
# Add Corrade as a subproject
add_subdirectory(corrade EXCLUDE_FROM_ALL)
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
# Add Magnum as a subproject, enable Sdl2Application
set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE)
set(MAGNUM_WITH_TGAIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)
find_package(Magnum REQUIRED GL Sdl2Application Trade TgaImporter)
message(STATUS "Magnum found: ${MAGNUM_FOUND}")
corrade_add_resource(RESOURCES Assets/resources.conf)
# Set the sources, allows VS to filter them properly
file(GLOB SOURCES "src/*.cpp")
file(GLOB HEADERS "src/*.h")
include_directories(include)
add_executable(${PNAME} ${SOURCES}
${RESOURCES})
add_dependencies(${PNAME} Magnum::TgaImporter)
target_link_libraries(${PNAME} PRIVATE
Corrade::Main
Magnum::Application
Magnum::GL
Magnum::Magnum
Magnum::Trade)
# Setup to use C++11 + others
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 11) # Use C++11