2017-07-23 02:45:36 +03:00
|
|
|
# All sorts of things that we need cross project
|
2017-10-11 23:33:09 +03:00
|
|
|
cmake_minimum_required(VERSION 2.8.0)
|
2017-07-23 02:45:36 +03:00
|
|
|
|
|
|
|
# Detect linux
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
set(LINUX TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Linking for OS X -framework options
|
|
|
|
# Will do nothing on other OSes
|
2017-10-11 23:33:09 +03:00
|
|
|
if(APPLE)
|
|
|
|
find_library(OPENGL_LIBRARY OpenGL)
|
|
|
|
find_library(OPENAL_LIBRARY OpenAL)
|
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
2017-07-23 02:45:36 +03:00
|
|
|
|
2017-10-11 23:33:09 +03:00
|
|
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${OPENAL_LIBRARY} ${COCOA_LIBRARY})
|
|
|
|
elseif(LINUX)
|
|
|
|
# Elsewhere (such as Linux), need `-lopenal -lGL`, etc...
|
|
|
|
set(LIBS_PRIVATE
|
|
|
|
m pthread dl
|
|
|
|
openal
|
|
|
|
GL
|
|
|
|
X11 Xrandr Xinerama Xi Xxf86vm Xcursor) # X11 stuff
|
|
|
|
else()
|
|
|
|
# TODO Windows
|
|
|
|
endif()
|
2017-07-23 02:45:36 +03:00
|
|
|
|
|
|
|
# Do the linking for executables that are meant to link raylib
|
|
|
|
function(link_libraries_to_executable executable)
|
|
|
|
# Link the libraries
|
2017-10-11 23:33:09 +03:00
|
|
|
target_link_libraries(${executable} ${LIBS_PRIVATE})
|
2017-07-23 02:45:36 +03:00
|
|
|
|
|
|
|
# And raylib
|
|
|
|
target_link_libraries(${executable} raylib)
|
|
|
|
endfunction()
|
|
|
|
|