-
Notifications
You must be signed in to change notification settings - Fork 141
/
CMakeLists.txt
31 lines (23 loc) · 957 Bytes
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
cmake_minimum_required (VERSION 2.8)
project (wave-share)
option(USE_FINDSDL2 "Use the FindSDL2.cmake script" OFF)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -Wno-long-long -pedantic")
#
## Dependencies
find_package(Threads REQUIRED)
find_package(SDL2)
if (NOT USE_FINDSDL2 AND NOT SDL2_FOUND)
message(WARNING "Unable to find SDL2 library. It is either not installed or CMake cannot find it."
" In the latter case, setting the USE_FINDSDL2 variable might help:\n"
" $ cmake -D USE_FINDSDL2 .."
)
message(FATAL_ERROR "Aborting")
endif()
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
add_executable(wave-share main.cpp)
target_include_directories(wave-share PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(wave-share PUBLIC ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARIES})