Skip to content

Instantly share code, notes, and snippets.

@jshbrntt
Last active August 29, 2015 14:11
Show Gist options
  • Save jshbrntt/5625f92758d80dff4be0 to your computer and use it in GitHub Desktop.
Save jshbrntt/5625f92758d80dff4be0 to your computer and use it in GitHub Desktop.
project(racer-sdl)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_executable(${PROJECT_NAME} src/main.cpp)
include(FindPkgConfig)
pkg_search_module(SDL2 sdl2)
if (SDL2_FOUND)
message(STATUS "Using SDL2")
add_definitions(-DUSE_SDL2)
include_directories(${SDL2_INCLUDE_DIRS})
link_directories(${SDL2_LIBRARY_DIRS})
link_libraries(${SDL2_LIBRARIES})
else ()
include(FindPkgConfig)
pkg_search_module(SDL sdl)
if (SDL_FOUND)
include_directories(${SDL_INCLUDE_DIRS})
link_directories(${SDL_LIBRARY_DIRS})
link_libraries(${SDL_LIBRARIES})
else ()
message(SEND_ERROR "This program requires SDL 1.2 or SDL 2.0 [recommended]")
endif ()
endif ()
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment