raylib/utils.cmake
Ahmad Fatoum 44376c04fa
Generate and install pkg-config pc file
After installation, compiling new programs is possible with
    $ cc game.c `pkg-config --static --libs --cflags raylib`
or
    $ cc game.c `pkg-config --libs --cflags raylib`
depending on configuration

Also adds following configuration options:
- WITH_PIC "Compile static library as position-independent code"
- STATIC_RAYLIB "Build raylib as a static library"
- MACOS_FATLIB  "Build fat library for both i386 and x86_64 on macOS"
2017-11-24 17:15:33 +01:00

37 lines
915 B
CMake

# All sorts of things that we need cross project
cmake_minimum_required(VERSION 2.8.0)
# Detect linux
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
# Linking for OS X -framework options
# Will do nothing on other OSes
if(APPLE)
find_library(OPENGL_LIBRARY OpenGL)
find_library(OPENAL_LIBRARY OpenAL)
find_library(COCOA_LIBRARY Cocoa)
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()
# Do the linking for executables that are meant to link raylib
function(link_libraries_to_executable executable)
# Link the libraries
target_link_libraries(${executable} ${LIBS_PRIVATE})
# And raylib
target_link_libraries(${executable} raylib)
endfunction()