Skip to content

Instantly share code, notes, and snippets.

@Alan-FGR
Created February 1, 2020 13:29
Show Gist options
  • Save Alan-FGR/35be286793b34325f2c26aba57516e26 to your computer and use it in GitHub Desktop.
Save Alan-FGR/35be286793b34325f2c26aba57516e26 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.15.0)
#config vars
set(minECS_BUILD_TESTBED true CACHE BOOL "Builds the SDL-powered testbed")
set(minECS_STATIC_SDL false CACHE BOOL "Links static SDL library")
project(minECS)
add_executable(minECS main.cpp)
if (minECS_BUILD_TESTBED)
set(PREPEND_DEPS)
if (CMAKE_GENERATOR MATCHES "MinGW Makefiles")
list(APPEND PREPEND_DEPS mingw32)
endif ()
if (minECS_STATIC_SDL)
list(APPEND PREPEND_DEPS
kernel32 advapi32 gdi32 imm32 msvcrt ole32 oleaut32 setupapi shell32 user32 version winmm)
else ()
add_custom_command(
TARGET minECS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_SOURCE_DIR}/SDL2/build/SDL2.dll
${CMAKE_BINARY_DIR})
endif ()
target_include_directories(minECS PUBLIC SDL2/include)
target_link_directories(minECS PUBLIC SDL2/build)
target_link_libraries(minECS LINK_PUBLIC ${PREPEND_DEPS} SDL2main SDL2)
endif ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment