Skip to content

Commit

Permalink
Add Linux support to CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Apr 25, 2014
1 parent 3f17076 commit dad0ad5
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#
# Simple CMakeLists for Sonic Robo Blast 2
#
# Tweaked for FreeBSD, but should be extendable to support other systems
#
PROJECT(SRB2)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
Expand All @@ -19,9 +17,8 @@ FIND_PACKAGE(PNG)
#

# not added defines:
# -DUSEASM - unportable assembler not needed
# -DHAVE_PNG - does not build (incorrect use of PNG_EXPORT etc.)
ADD_DEFINITIONS(-DDIRECTFULLSCREEN -DSDL -DHAVE_MIXER -DNOHW -DHW3SOUND -DHAVE_BLUA)
ADD_DEFINITIONS(-DDIRECTFULLSCREEN -DSDL -DHAVE_MIXER -DNOHW -DHW3SOUND -DHAVE_BLUA -DNOASM)

SET(SDL_DIR sdl) # may be set to SDL2 optionally

Expand Down Expand Up @@ -145,15 +142,24 @@ SET(COMMON_SRCS
#
# Platform-specific stuff
#

MACRO(EXTRALIB NAME)
FIND_LIBRARY(${NAME}_LIBRARY NAMES ${NAME})
IF(${NAME}_LIBRARY)
MESSAGE(STATUS "Found lib${NAME}: ${${NAME}_LIBRARY}")
SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${${NAME}_LIBRARY})
ELSE(${NAME}_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find lib${NAME}!")
ENDIF(${NAME}_LIBRARY)
ENDMACRO(EXTRALIB)

IF(${CMAKE_SYSTEM} MATCHES "FreeBSD")
FIND_LIBRARY(KVM_LIBRARY NAMES kvm)
IF(KVM_LIBRARY)
MESSAGE(STATUS "Found libkvm: ${KVM_LIBRARY}")
SET(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} ${KVM_LIBRARY})
ELSE(KVM_LIBRARY)
MESSAGE(FATAL_ERROR "Could not find libkvm!")
ENDIF(KVM_LIBRARY)
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX -DFREEBSD)
EXTRALIB(kvm)
ELSEIF(${CMAKE_SYSTEM} MATCHES "Linux")
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
EXTRALIB(m)
EXTRALIB(rt)
ELSE(${CMAKE_SYSTEM} MATCHES "FreeBSD")
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
MESSAGE(WARNING "No specific settings for you system, it may be not supported!")
Expand Down

0 comments on commit dad0ad5

Please sign in to comment.