Add Linux support to CMake

This commit is contained in:
Dmitry Marakasov 2014-04-25 02:59:08 +04:00
parent 3f170769da
commit dad0ad59c1

View file

@ -1,8 +1,6 @@
# #
# Simple CMakeLists for Sonic Robo Blast 2 # Simple CMakeLists for Sonic Robo Blast 2
# #
# Tweaked for FreeBSD, but should be extendable to support other systems
#
PROJECT(SRB2) PROJECT(SRB2)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
@ -19,9 +17,8 @@ FIND_PACKAGE(PNG)
# #
# not added defines: # not added defines:
# -DUSEASM - unportable assembler not needed
# -DHAVE_PNG - does not build (incorrect use of PNG_EXPORT etc.) # -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 SET(SDL_DIR sdl) # may be set to SDL2 optionally
@ -145,15 +142,24 @@ SET(COMMON_SRCS
# #
# Platform-specific stuff # 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") 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) 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") ELSE(${CMAKE_SYSTEM} MATCHES "FreeBSD")
ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX) ADD_DEFINITIONS(-DUNIXCOMMON -DLINUX)
MESSAGE(WARNING "No specific settings for you system, it may be not supported!") MESSAGE(WARNING "No specific settings for you system, it may be not supported!")