Move to no-argument version of "endif()" in CMakeLists.txt.

This commit is contained in:
Ryan C. Gordon 2014-01-28 12:42:01 -05:00
parent 2de3b01c61
commit 4f1b8a4067
1 changed files with 124 additions and 123 deletions

View File

@ -51,17 +51,17 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
else() else()
set(ARCH_64 FALSE) set(ARCH_64 FALSE)
set(PROCESSOR_ARCH "x86") set(PROCESSOR_ARCH "x86")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8) endif()
set(LIBNAME SDL2) set(LIBNAME SDL2)
if(NOT LIBTYPE) if(NOT LIBTYPE)
set(LIBTYPE SHARED) set(LIBTYPE SHARED)
endif(NOT LIBTYPE) endif()
# Get the platform # Get the platform
if(WIN32) if(WIN32)
if(NOT WINDOWS) if(NOT WINDOWS)
set(WINDOWS TRUE) set(WINDOWS TRUE)
endif(NOT WINDOWS) endif()
elseif(UNIX AND NOT APPLE) elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux") if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(LINUX TRUE) set(LINUX TRUE)
@ -106,13 +106,13 @@ if(UNIX AND NOT APPLE)
set(UNIX_SYS ON) set(UNIX_SYS ON)
else() else()
set(UNIX_SYS OFF) set(UNIX_SYS OFF)
endif(UNIX AND NOT APPLE) endif()
if(UNIX OR APPLE) if(UNIX OR APPLE)
set(UNIX_OR_MAC_SYS ON) set(UNIX_OR_MAC_SYS ON)
else() else()
set(UNIX_OR_MAC_SYS OFF) set(UNIX_OR_MAC_SYS OFF)
endif(UNIX OR APPLE) endif()
# Default option knobs # Default option knobs
if(APPLE OR ARCH_64) if(APPLE OR ARCH_64)
@ -120,7 +120,7 @@ if(APPLE OR ARCH_64)
endif() endif()
if(UNIX OR MINGW OR MSYS) if(UNIX OR MINGW OR MSYS)
set(OPT_DEF_LIBC ON) set(OPT_DEF_LIBC ON)
endif(UNIX OR MINGW OR MSYS) endif()
# Compiler info # Compiler info
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
@ -134,20 +134,20 @@ elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
#set(CMAKE_C_FLAGS "/ZI /WX- / #set(CMAKE_C_FLAGS "/ZI /WX- /
else() else()
set(OPT_DEF_ASM FALSE) set(OPT_DEF_ASM FALSE)
endif(CMAKE_COMPILER_IS_GNUCC) endif()
# Default flags, if not set otherwise # Default flags, if not set otherwise
if("$ENV{CFLAGS}" STREQUAL "") if("$ENV{CFLAGS}" STREQUAL "")
if(USE_GCC OR USE_CLANG) if(USE_GCC OR USE_CLANG)
set(CMAKE_C_FLAGS "-g -O3") set(CMAKE_C_FLAGS "-g -O3")
endif(USE_GCC OR USE_CLANG) endif()
else("$ENV{CFLAGS}" STREQUAL "") else("$ENV{CFLAGS}" STREQUAL "")
set(CMAKE_C_FLAGS "$ENV{CFLAGS}") set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}") list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}")
endif("$ENV{CFLAGS}" STREQUAL "") endif()
if(NOT ("$ENV{CFLAGS}" STREQUAL "")) # Hackish, but does the trick on Win32 if(NOT ("$ENV{CFLAGS}" STREQUAL "")) # Hackish, but does the trick on Win32
list(APPEND EXTRA_LDFLAGS "$ENV{LDFLAGS}") list(APPEND EXTRA_LDFLAGS "$ENV{LDFLAGS}")
endif(NOT ("$ENV{CFLAGS}" STREQUAL "")) endif()
if(MSVC) if(MSVC)
option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
@ -160,7 +160,7 @@ if(MSVC)
endif() endif()
endforeach(flag_var) endforeach(flag_var)
endif() endif()
endif(MSVC) endif()
# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config, # Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config,
# etc. are created correctly. # etc. are created correctly.
@ -177,9 +177,9 @@ if(CYGWIN)
if(HAVE_GCC_NO_CYGWIN) if(HAVE_GCC_NO_CYGWIN)
list(APPEND EXTRA_LDFLAGS "-mno-cygwin") list(APPEND EXTRA_LDFLAGS "-mno-cygwin")
list(APPEND SDL_LIBS "-mno-cygwin") list(APPEND SDL_LIBS "-mno-cygwin")
endif(HAVE_GCC_NO_CYGWIN) endif()
set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw") set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw")
endif(CYGWIN) endif()
add_definitions(-DUSING_GENERATED_CONFIG_H) add_definitions(-DUSING_GENERATED_CONFIG_H)
# General includes # General includes
@ -278,7 +278,7 @@ elseif(ASSERTIONS STREQUAL "paranoid")
set(SDL_DEFAULT_ASSERT_LEVEL 3) set(SDL_DEFAULT_ASSERT_LEVEL 3)
else() else()
message_error("unknown assertion level") message_error("unknown assertion level")
endif(ASSERTIONS STREQUAL "auto") endif()
set(HAVE_ASSERTIONS ${ASSERTIONS}) set(HAVE_ASSERTIONS ${ASSERTIONS})
# Compiler option evaluation # Compiler option evaluation
@ -289,7 +289,7 @@ if(USE_GCC OR USE_CLANG)
#error Dependency tracking requires GCC 3.0 or newer #error Dependency tracking requires GCC 3.0 or newer
#endif #endif
int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING) int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING)
endif(DEPENDENCY_TRACKING) endif()
if(GCC_ATOMICS) if(GCC_ATOMICS)
check_c_source_compiles("int main(int argc, char **argv) { check_c_source_compiles("int main(int argc, char **argv) {
@ -305,8 +305,8 @@ if(USE_GCC OR USE_CLANG)
int a; int a;
__sync_lock_test_and_set(&a, 1); __sync_lock_test_and_set(&a, 1);
__sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) __sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
endif(NOT HAVE_GCC_ATOMICS) endif()
endif(GCC_ATOMICS) endif()
set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2") set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2")
check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}" check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}"
@ -321,16 +321,16 @@ if(USE_GCC OR USE_CLANG)
int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY) int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY)
if(HAVE_GCC_FVISIBILITY) if(HAVE_GCC_FVISIBILITY)
list(APPEND EXTRA_CFLAGS "-fvisibility=hidden") list(APPEND EXTRA_CFLAGS "-fvisibility=hidden")
endif(HAVE_GCC_FVISIBILITY) endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
check_c_compiler_flag(-Wall HAVE_GCC_WALL) check_c_compiler_flag(-Wall HAVE_GCC_WALL)
if(HAVE_GCC_WALL) if(HAVE_GCC_WALL)
if(HAIKU) if(HAIKU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
endif(HAIKU) endif()
endif(HAVE_GCC_WALL) endif()
endif(USE_GCC OR USE_CLANG) endif()
if(ASSEMBLY) if(ASSEMBLY)
if(USE_GCC OR USE_CLANG) if(USE_GCC OR USE_CLANG)
@ -357,9 +357,9 @@ if(ASSEMBLY)
int main(int argc, char **argv) { }" HAVE_MMX) int main(int argc, char **argv) { }" HAVE_MMX)
if(HAVE_MMX) if(HAVE_MMX)
list(APPEND EXTRA_CFLAGS "-mmmx") list(APPEND EXTRA_CFLAGS "-mmmx")
endif(HAVE_MMX) endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(MMX) endif()
if(3DNOW) if(3DNOW)
set(CMAKE_REQUIRED_FLAGS "-m3dnow") set(CMAKE_REQUIRED_FLAGS "-m3dnow")
@ -374,9 +374,9 @@ if(ASSEMBLY)
}" HAVE_3DNOW) }" HAVE_3DNOW)
if(HAVE_3DNOW) if(HAVE_3DNOW)
list(APPEND EXTRA_CFLAGS "-m3dnow") list(APPEND EXTRA_CFLAGS "-m3dnow")
endif(HAVE_3DNOW) endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(3DNOW) endif()
if(SSE) if(SSE)
set(CMAKE_REQUIRED_FLAGS "-msse") set(CMAKE_REQUIRED_FLAGS "-msse")
@ -397,9 +397,9 @@ if(ASSEMBLY)
int main(int argc, char **argv) { }" HAVE_SSE) int main(int argc, char **argv) { }" HAVE_SSE)
if(HAVE_SSE) if(HAVE_SSE)
list(APPEND EXTRA_CFLAGS "-msse") list(APPEND EXTRA_CFLAGS "-msse")
endif(HAVE_SSE) endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(SSE) endif()
if(SSE2) if(SSE2)
set(CMAKE_REQUIRED_FLAGS "-msse2") set(CMAKE_REQUIRED_FLAGS "-msse2")
@ -420,18 +420,18 @@ if(ASSEMBLY)
int main(int argc, char **argv) { }" HAVE_SSE2) int main(int argc, char **argv) { }" HAVE_SSE2)
if(HAVE_SSE2) if(HAVE_SSE2)
list(APPEND EXTRA_CFLAGS "-msse2") list(APPEND EXTRA_CFLAGS "-msse2")
endif(HAVE_SSE2) endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(SSE2) endif()
if(SSEMATH) if(SSEMATH)
if(SSE OR SSE2) if(SSE OR SSE2)
if(USE_GCC) if(USE_GCC)
list(APPEND EXTRA_CFLAGS "-mfpmath=387") list(APPEND EXTRA_CFLAGS "-mfpmath=387")
endif(USE_GCC) endif()
set(HAVE_SSEMATH TRUE) set(HAVE_SSEMATH TRUE)
endif(SSE OR SSE2) endif()
endif(SSEMATH) endif()
if(ALTIVEC) if(ALTIVEC)
set(CMAKE_REQUIRED_FLAGS "-maltivec") set(CMAKE_REQUIRED_FLAGS "-maltivec")
@ -453,26 +453,26 @@ if(ASSEMBLY)
set(SDL_ALTIVEC_BLITTERS 1) set(SDL_ALTIVEC_BLITTERS 1)
if(HAVE_ALTIVEC_H_HDR) if(HAVE_ALTIVEC_H_HDR)
set(HAVE_ALTIVEC_H 1) set(HAVE_ALTIVEC_H 1)
endif(HAVE_ALTIVEC_H_HDR) endif()
endif(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR) endif()
endif(ALTIVEC) endif()
elseif(MSVC_VERSION GREATER 1500) elseif(MSVC_VERSION GREATER 1500)
# TODO: SDL_cpuinfo.h needs to support the user's configuration wish # TODO: SDL_cpuinfo.h needs to support the user's configuration wish
# for MSVC - right now it is always activated # for MSVC - right now it is always activated
if(NOT ARCH_64) if(NOT ARCH_64)
set(HAVE_MMX TRUE) set(HAVE_MMX TRUE)
set(HAVE_3DNOW TRUE) set(HAVE_3DNOW TRUE)
endif(NOT ARCH_64) endif()
set(HAVE_SSE TRUE) set(HAVE_SSE TRUE)
set(HAVE_SSE2 TRUE) set(HAVE_SSE2 TRUE)
set(SDL_ASSEMBLY_ROUTINES 1) set(SDL_ASSEMBLY_ROUTINES 1)
endif(USE_GCC OR USE_CLANG) endif()
# TODO: # TODO:
#else(ASSEMBLY) #else(ASSEMBLY)
# if(USE_GCC OR USE_CLANG) # if(USE_GCC OR USE_CLANG)
# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") # list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx")
# endif(USE_GCC OR USE_CLANG) # endif()
endif(ASSEMBLY) endif()
# TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define # TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define
# anything. # anything.
@ -496,7 +496,7 @@ if(LIBC)
endforeach() endforeach()
if(NOT CYGWIN AND NOT MINGW) if(NOT CYGWIN AND NOT MINGW)
set(HAVE_ALLOCA 1) set(HAVE_ALLOCA 1)
endif(NOT CYGWIN AND NOT MINGW) endif()
set(HAVE_M_PI 1) set(HAVE_M_PI 1)
add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI
set(STDC_HEADERS 1) set(STDC_HEADERS 1)
@ -544,21 +544,21 @@ if(LIBC)
endforeach() endforeach()
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND EXTRA_LIBS m) list(APPEND EXTRA_LIBS m)
endif(HAVE_LIBM) endif()
check_library_exists(iconv iconv_open "" HAVE_LIBICONV) check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
if(HAVE_LIBICONV) if(HAVE_LIBICONV)
list(APPEND EXTRA_LIBS iconv) list(APPEND EXTRA_LIBS iconv)
endif(HAVE_LIBICONV) endif()
check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION) check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION)
endif(WINDOWS AND NOT MINGW) endif()
else(LIBC) else(LIBC)
if(WINDOWS) if(WINDOWS)
set(HAVE_STDARG_H 1) set(HAVE_STDARG_H 1)
set(HAVE_STDDEF_H 1) set(HAVE_STDDEF_H 1)
endif(WINDOWS) endif()
endif(LIBC) endif()
# Enable/disable various subsystems of the SDL library # Enable/disable various subsystems of the SDL library
@ -566,24 +566,24 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
string(TOUPPER ${_SUB} _OPT) string(TOUPPER ${_SUB} _OPT)
if(NOT SDL_${_OPT}) if(NOT SDL_${_OPT})
set(SDL_${_OPT}_DISABLED 1) set(SDL_${_OPT}_DISABLED 1)
endif(NOT SDL_${_OPT}) endif()
endforeach() endforeach()
if(SDL_JOYSTICK) if(SDL_JOYSTICK)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif(SDL_JOYSTICK) endif()
if(SDL_HAPTIC) if(SDL_HAPTIC)
if(NOT SDL_JOYSTICK) if(NOT SDL_JOYSTICK)
# Haptic requires some private functions from the joystick subsystem. # Haptic requires some private functions from the joystick subsystem.
message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled") message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled")
endif(NOT SDL_JOYSTICK) endif()
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
endif(SDL_HAPTIC) endif()
if(SDL_POWER) if(SDL_POWER)
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
endif(SDL_POWER) endif()
# TODO: in configure.in, the test for LOADSO and SDL_DLOPEN is a bit weird: # TODO: in configure.in, the test for LOADSO and SDL_DLOPEN is a bit weird:
# if LOADSO is not wanted, SDL_LOADSO_DISABLED is set # if LOADSO is not wanted, SDL_LOADSO_DISABLED is set
# If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(), # If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(),
@ -597,21 +597,21 @@ if(SDL_AUDIO)
file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES})
set(HAVE_DUMMYAUDIO TRUE) set(HAVE_DUMMYAUDIO TRUE)
endif(DUMMYAUDIO) endif()
if(DISKAUDIO) if(DISKAUDIO)
set(SDL_AUDIO_DRIVER_DISK 1) set(SDL_AUDIO_DRIVER_DISK 1)
file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES})
set(HAVE_DISKAUDIO TRUE) set(HAVE_DISKAUDIO TRUE)
endif(DISKAUDIO) endif()
endif(SDL_AUDIO) endif()
if(SDL_DLOPEN) if(SDL_DLOPEN)
# Relevant for Unix/Darwin only # Relevant for Unix/Darwin only
if(UNIX OR APPLE) if(UNIX OR APPLE)
CheckDLOPEN() CheckDLOPEN()
endif(UNIX OR APPLE) endif()
endif(SDL_DLOPEN) endif()
if(SDL_VIDEO) if(SDL_VIDEO)
if(VIDEO_DUMMY) if(VIDEO_DUMMY)
@ -620,8 +620,8 @@ if(SDL_VIDEO)
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES})
set(HAVE_VIDEO_DUMMY TRUE) set(HAVE_VIDEO_DUMMY TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif(VIDEO_DUMMY) endif()
endif(SDL_VIDEO) endif()
# Platform-specific options and settings # Platform-specific options and settings
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
@ -650,7 +650,7 @@ if(UNIX AND NOT APPLE)
CheckNAS() CheckNAS()
CheckSNDIO() CheckSNDIO()
CheckFusionSound() CheckFusionSound()
endif(SDL_AUDIO) endif()
if(SDL_VIDEO) if(SDL_VIDEO)
CheckX11() CheckX11()
@ -658,7 +658,7 @@ if(UNIX AND NOT APPLE)
CheckOpenGLX11() CheckOpenGLX11()
CheckOpenGLESX11() CheckOpenGLESX11()
CheckWayland() CheckWayland()
endif(SDL_VIDEO) endif()
if(LINUX) if(LINUX)
check_c_source_compiles(" check_c_source_compiles("
@ -684,24 +684,24 @@ if(UNIX AND NOT APPLE)
if(HAVE_INPUT_EVENTS) if(HAVE_INPUT_EVENTS)
set(SDL_INPUT_LINUXEV 1) set(SDL_INPUT_LINUXEV 1)
endif(HAVE_INPUT_EVENTS) endif()
if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) if(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
set(SDL_HAPTIC_LINUX 1) set(SDL_HAPTIC_LINUX 1)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
set(HAVE_SDL_HAPTIC TRUE) set(HAVE_SDL_HAPTIC TRUE)
endif(SDL_HAPTIC AND HAVE_INPUT_EVENTS) endif()
if(HAVE_INPUT_KD) if(HAVE_INPUT_KD)
set(SDL_INPUT_LINUXKD 1) set(SDL_INPUT_LINUXKD 1)
endif(HAVE_INPUT_KD) endif()
check_include_file("libudev.h" HAVE_LIBUDEV_H) check_include_file("libudev.h" HAVE_LIBUDEV_H)
# !!! FIXME: this needs pkg-config to find the include path, I think. # !!! FIXME: this needs pkg-config to find the include path, I think.
check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H) check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H)
endif(LINUX) endif()
if(INPUT_TSLIB) if(INPUT_TSLIB)
check_c_source_compiles(" check_c_source_compiles("
@ -710,8 +710,8 @@ if(UNIX AND NOT APPLE)
if(HAVE_INPUT_TSLIB) if(HAVE_INPUT_TSLIB)
set(SDL_INPUT_TSLIB 1) set(SDL_INPUT_TSLIB 1)
list(APPEND EXTRA_LIBS ts) list(APPEND EXTRA_LIBS ts)
endif(HAVE_INPUT_TSLIB) endif()
endif(INPUT_TSLIB) endif()
if(SDL_JOYSTICK) if(SDL_JOYSTICK)
CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? CheckUSBHID() # seems to be BSD specific - limit the test to BSD only?
@ -720,8 +720,8 @@ if(UNIX AND NOT APPLE)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_SDL_JOYSTICK TRUE)
endif(LINUX) endif()
endif(SDL_JOYSTICK) endif()
CheckPTHREAD() CheckPTHREAD()
@ -734,14 +734,14 @@ if(UNIX AND NOT APPLE)
check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME) check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME)
if(FOUND_CLOCK_GETTIME) if(FOUND_CLOCK_GETTIME)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
endif(FOUND_CLOCK_GETTIME) endif()
endif(HAVE_CLOCK_GETTIME) endif()
endif(CLOCK_GETTIME) endif()
check_include_file(linux/version.h HAVE_LINUX_VERSION_H) check_include_file(linux/version.h HAVE_LINUX_VERSION_H)
if(HAVE_LINUX_VERSION_H) if(HAVE_LINUX_VERSION_H)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H")
endif(HAVE_LINUX_VERSION_H) endif()
if(SDL_POWER) if(SDL_POWER)
if(LINUX) if(LINUX)
@ -749,22 +749,22 @@ if(UNIX AND NOT APPLE)
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
set(HAVE_SDL_POWER TRUE) set(HAVE_SDL_POWER TRUE)
endif(LINUX) endif()
endif(SDL_POWER) endif()
if(SDL_FILESYSTEM) if(SDL_FILESYSTEM)
set(SDL_FILESYSTEM_UNIX 1) set(SDL_FILESYSTEM_UNIX 1)
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
set(HAVE_SDL_FILESYSTEM TRUE) set(HAVE_SDL_FILESYSTEM TRUE)
endif(SDL_FILESYSTEM) endif()
if(SDL_TIMERS) if(SDL_TIMERS)
set(SDL_TIMER_UNIX 1) set(SDL_TIMER_UNIX 1)
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE) set(HAVE_SDL_TIMERS TRUE)
endif(SDL_TIMERS) endif()
if(RPATH) if(RPATH)
set(SDL_RLD_FLAGS "") set(SDL_RLD_FLAGS "")
@ -775,7 +775,7 @@ if(UNIX AND NOT APPLE)
endif() endif()
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(HAVE_RPATH TRUE) set(HAVE_RPATH TRUE)
endif(RPATH) endif()
elseif(WINDOWS) elseif(WINDOWS)
find_program(WINDRES windres) find_program(WINDRES windres)
@ -791,7 +791,7 @@ elseif(WINDOWS)
if(DIRECTX) if(DIRECTX)
if("$ENV{DXSDK_DIR}" STREQUAL "") if("$ENV{DXSDK_DIR}" STREQUAL "")
message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set") message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
endif("$ENV{DXSDK_DIR}" STREQUAL "") endif()
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"") set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(ddraw.h HAVE_DDRAW_H)
@ -805,7 +805,7 @@ elseif(WINDOWS)
include_directories($ENV{DXSDK_DIR}\\Include) include_directories($ENV{DXSDK_DIR}\\Include)
endif() endif()
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(DIRECTX) endif()
if(SDL_AUDIO) if(SDL_AUDIO)
set(SDL_AUDIO_DRIVER_WINMM 1) set(SDL_AUDIO_DRIVER_WINMM 1)
@ -817,20 +817,20 @@ elseif(WINDOWS)
set(SDL_AUDIO_DRIVER_DSOUND 1) set(SDL_AUDIO_DRIVER_DSOUND 1)
file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
endif(HAVE_DSOUND_H) endif()
if(HAVE_XAUDIO2_H) if(HAVE_XAUDIO2_H)
set(SDL_AUDIO_DRIVER_XAUDIO2 1) set(SDL_AUDIO_DRIVER_XAUDIO2 1)
file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c) file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES})
endif(HAVE_XAUDIO2_H) endif()
endif(SDL_AUDIO) endif()
if(SDL_VIDEO) if(SDL_VIDEO)
# requires SDL_LOADSO on Windows (IME, DX, etc.) # requires SDL_LOADSO on Windows (IME, DX, etc.)
if(NOT SDL_LOADSO) if(NOT SDL_LOADSO)
message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled") message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled")
endif(NOT SDL_LOADSO) endif()
set(SDL_VIDEO_DRIVER_WINDOWS 1) set(SDL_VIDEO_DRIVER_WINDOWS 1)
file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES})
@ -838,9 +838,9 @@ elseif(WINDOWS)
if(RENDER_D3D AND HAVE_D3D_H) if(RENDER_D3D AND HAVE_D3D_H)
set(SDL_VIDEO_RENDER_D3D 1) set(SDL_VIDEO_RENDER_D3D 1)
set(HAVE_RENDER_D3D TRUE) set(HAVE_RENDER_D3D TRUE)
endif(RENDER_D3D AND HAVE_D3D_H) endif()
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif(SDL_VIDEO) endif()
if(SDL_THREADS) if(SDL_THREADS)
set(SDL_THREAD_WINDOWS 1) set(SDL_THREAD_WINDOWS 1)
@ -851,20 +851,20 @@ elseif(WINDOWS)
${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c
${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c) ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c)
set(HAVE_SDL_THREADS TRUE) set(HAVE_SDL_THREADS TRUE)
endif(SDL_THREADS) endif()
if(SDL_POWER) if(SDL_POWER)
set(SDL_POWER_WINDOWS 1) set(SDL_POWER_WINDOWS 1)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c)
set(HAVE_SDL_POWER TRUE) set(HAVE_SDL_POWER TRUE)
endif(SDL_POWER) endif()
if(SDL_FILESYSTEM) if(SDL_FILESYSTEM)
set(SDL_FILESYSTEM_WINDOWS 1) set(SDL_FILESYSTEM_WINDOWS 1)
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
set(HAVE_SDL_FILESYSTEM TRUE) set(HAVE_SDL_FILESYSTEM TRUE)
endif(SDL_FILESYSTEM) endif()
# Libraries for Win32 native and MinGW # Libraries for Win32 native and MinGW
list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid) list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
@ -876,14 +876,14 @@ elseif(WINDOWS)
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE) set(HAVE_SDL_TIMERS TRUE)
endif(SDL_TIMERS) endif()
if(SDL_LOADSO) if(SDL_LOADSO)
set(SDL_LOADSO_WINDOWS 1) set(SDL_LOADSO_WINDOWS 1)
file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
set(HAVE_SDL_LOADSO TRUE) set(HAVE_SDL_LOADSO TRUE)
endif(SDL_LOADSO) endif()
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
@ -894,8 +894,8 @@ elseif(WINDOWS)
set(SDL_VIDEO_OPENGL_WGL 1) set(SDL_VIDEO_OPENGL_WGL 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_VIDEO_OPENGL TRUE)
endif(VIDEO_OPENGL) endif()
endif(SDL_VIDEO) endif()
if(SDL_JOYSTICK) if(SDL_JOYSTICK)
if(HAVE_DINPUT_H) if(HAVE_DINPUT_H)
@ -905,15 +905,15 @@ elseif(WINDOWS)
else() else()
set(SDL_JOYSTICK_WINMM 1) set(SDL_JOYSTICK_WINMM 1)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_mmjoystick.c) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/joystick/windows/SDL_mmjoystick.c)
endif(HAVE_DINPUT_H) endif()
set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_SDL_JOYSTICK TRUE)
endif(SDL_JOYSTICK) endif()
if(SDL_HAPTIC AND HAVE_DINPUT_H) if(SDL_HAPTIC AND HAVE_DINPUT_H)
set(SDL_HAPTIC_DINPUT 1) set(SDL_HAPTIC_DINPUT 1)
set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c) set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/haptic/windows/SDL_syshaptic.c)
set(HAVE_SDL_HAPTIC TRUE) set(HAVE_SDL_HAPTIC TRUE)
endif(SDL_HAPTIC AND HAVE_DINPUT_H) endif()
file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c)
@ -922,7 +922,7 @@ elseif(WINDOWS)
list(APPEND EXTRA_LDFLAGS "-mwindows") list(APPEND EXTRA_LDFLAGS "-mwindows")
set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main") set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main")
list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows")
endif(MINGW OR CYGWIN) endif()
elseif(APPLE) elseif(APPLE)
# TODO: rework this for proper MacOS X, iOS and Darwin support # TODO: rework this for proper MacOS X, iOS and Darwin support
@ -1026,10 +1026,10 @@ elseif(APPLE)
if(DARWIN) if(DARWIN)
find_library(OpenGL_LIBRARY OpenGL) find_library(OpenGL_LIBRARY OpenGL)
list(APPEND EXTRA_LIBRARIES ${OpenGL_LIBRARY}) list(APPEND EXTRA_LIBRARIES ${OpenGL_LIBRARY})
endif(DARWIN) endif()
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_VIDEO_OPENGL TRUE)
endif(VIDEO_OPENGL) endif()
endif(SDL_VIDEO) endif()
CheckPTHREAD() CheckPTHREAD()
elseif(HAIKU) elseif(HAIKU)
@ -1058,8 +1058,8 @@ elseif(HAIKU)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND EXTRA_LIBS GL) list(APPEND EXTRA_LIBS GL)
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_VIDEO_OPENGL TRUE)
endif(VIDEO_OPENGL) endif()
endif(SDL_VIDEO) endif()
CheckPTHREAD() CheckPTHREAD()
endif() endif()
@ -1079,45 +1079,45 @@ if(NOT HAVE_SDL_JOYSTICK)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
endif() endif()
endif(NOT HAVE_SDL_JOYSTICK) endif()
if(NOT HAVE_SDL_HAPTIC) if(NOT HAVE_SDL_HAPTIC)
set(SDL_HAPTIC_DISABLED 1) set(SDL_HAPTIC_DISABLED 1)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
endif(NOT HAVE_SDL_HAPTIC) endif()
if(NOT HAVE_SDL_LOADSO) if(NOT HAVE_SDL_LOADSO)
set(SDL_LOADSO_DISABLED 1) set(SDL_LOADSO_DISABLED 1)
file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
endif(NOT HAVE_SDL_LOADSO) endif()
if(NOT HAVE_SDL_FILESYSTEM) if(NOT HAVE_SDL_FILESYSTEM)
set(SDL_FILESYSTEM_DISABLED 1) set(SDL_FILESYSTEM_DISABLED 1)
file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
endif(NOT HAVE_SDL_FILESYSTEM) endif()
# We always need to have threads and timers around # We always need to have threads and timers around
if(NOT HAVE_SDL_THREADS) if(NOT HAVE_SDL_THREADS)
set(SDL_THREADS_DISABLED 1) set(SDL_THREADS_DISABLED 1)
file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${THREADS_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${THREADS_SOURCES})
endif(NOT HAVE_SDL_THREADS) endif()
if(NOT HAVE_SDL_TIMERS) if(NOT HAVE_SDL_TIMERS)
set(SDL_TIMERS_DISABLED 1) set(SDL_TIMERS_DISABLED 1)
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c) file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
endif(NOT HAVE_SDL_TIMERS) endif()
if(NOT SDLMAIN_SOURCES) if(NOT SDLMAIN_SOURCES)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c)
endif(NOT SDLMAIN_SOURCES) endif()
# Append the -MMD -MT flags # Append the -MMD -MT flags
# if(DEPENDENCY_TRACKING) # if(DEPENDENCY_TRACKING)
# if(COMPILER_IS_GNUCC) # if(COMPILER_IS_GNUCC)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -MT \$@") # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -MT \$@")
# endif(COMPILER_IS_GNUCC) # endif()
# endif(DEPENDENCY_TRACKING) # endif()
configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake" configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake"
"${SDL2_BINARY_DIR}/include/SDL_config.h") "${SDL2_BINARY_DIR}/include/SDL_config.h")
@ -1125,13 +1125,13 @@ configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake"
# Prepare the flags and remove duplicates # Prepare the flags and remove duplicates
if(EXTRA_LDFLAGS) if(EXTRA_LDFLAGS)
list(REMOVE_DUPLICATES EXTRA_LDFLAGS) list(REMOVE_DUPLICATES EXTRA_LDFLAGS)
endif(EXTRA_LDFLAGS) endif()
if(EXTRA_LIBS) if(EXTRA_LIBS)
list(REMOVE_DUPLICATES EXTRA_LIBS) list(REMOVE_DUPLICATES EXTRA_LIBS)
endif(EXTRA_LIBS) endif()
if(EXTRA_CFLAGS) if(EXTRA_CFLAGS)
list(REMOVE_DUPLICATES EXTRA_CFLAGS) list(REMOVE_DUPLICATES EXTRA_CFLAGS)
endif(EXTRA_CFLAGS) endif()
listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS) listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS)
set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) set(EXTRA_CFLAGS ${_EXTRA_CFLAGS})
@ -1151,14 +1151,14 @@ if(NOT WINDOWS OR CYGWIN)
else(SDL_STATIC) else(SDL_STATIC)
set(ENABLE_STATIC_TRUE "#") set(ENABLE_STATIC_TRUE "#")
set(ENABLE_STATIC_FALSE "") set(ENABLE_STATIC_FALSE "")
endif(SDL_STATIC) endif()
if(SDL_SHARED) if(SDL_SHARED)
set(ENABLE_SHARED_TRUE "") set(ENABLE_SHARED_TRUE "")
set(ENABLE_SHARED_FALSE "#") set(ENABLE_SHARED_FALSE "#")
else(SDL_SHARED) else(SDL_SHARED)
set(ENABLE_SHARED_TRUE "#") set(ENABLE_SHARED_TRUE "#")
set(ENABLE_SHARED_FALSE "") set(ENABLE_SHARED_FALSE "")
endif(SDL_SHARED) endif()
# Clean up the different lists # Clean up the different lists
listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
@ -1180,7 +1180,7 @@ if(NOT WINDOWS OR CYGWIN)
"${SDL2_BINARY_DIR}/sdl2-config" @ONLY) "${SDL2_BINARY_DIR}/sdl2-config" @ONLY)
configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in" configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in"
"${SDL2_BINARY_DIR}/SDL2.spec" @ONLY) "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY)
endif(NOT WINDOWS OR CYGWIN) endif()
##### Info output ##### ##### Info output #####
message(STATUS "") message(STATUS "")
@ -1220,7 +1220,7 @@ if(UNIX)
message(STATUS "were installed, then make sure you have set the") message(STATUS "were installed, then make sure you have set the")
message(STATUS "CFLAGS and LDFLAGS environment variables correctly.") message(STATUS "CFLAGS and LDFLAGS environment variables correctly.")
message(STATUS "") message(STATUS "")
endif(UNIX) endif()
# Ensure that the extra cflags are used at compile time # Ensure that the extra cflags are used at compile time
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
@ -1241,10 +1241,10 @@ if(SDL_SHARED)
VERSION ${SDL_VERSION} VERSION ${SDL_VERSION}
SOVERSION ${LT_CURRENT} SOVERSION ${LT_CURRENT}
OUTPUT_NAME "SDL2") OUTPUT_NAME "SDL2")
endif(UNIX) endif()
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
endif(SDL_SHARED) endif()
if(SDL_STATIC) if(SDL_STATIC)
set (BUILD_SHARED_LIBS FALSE) set (BUILD_SHARED_LIBS FALSE)
@ -1254,12 +1254,12 @@ if(SDL_STATIC)
set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
endif(WINDOWS) endif()
# TODO: Win32 platforms keep the same suffix .lib for import and static # TODO: Win32 platforms keep the same suffix .lib for import and static
# libraries - do we need to consider this? # libraries - do we need to consider this?
set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
endif(SDL_STATIC) endif()
##### Installation targets ##### ##### Installation targets #####
install(TARGETS ${_INSTALL_LIBS} install(TARGETS ${_INSTALL_LIBS}
@ -1280,7 +1280,7 @@ if(SDL_SHARED)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"libSDL2-2.0.so\" \"libSDL2.so\")") \"libSDL2-2.0.so\" \"libSDL2.so\")")
install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}") install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}")
endif(SDL_SHARED) endif()
if(NOT WINDOWS OR CYGWIN) if(NOT WINDOWS OR CYGWIN)
if(FREEBSD) if(FREEBSD)
@ -1289,8 +1289,9 @@ if(NOT WINDOWS OR CYGWIN)
else(FREEBSD) else(FREEBSD)
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
DESTINATION "lib${LIB_SUFFIX}/pkgconfig") DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
endif(FREEBSD) endif()
install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin) install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
# TODO: what about the .spec file? Is it only needed for RPM creation? # TODO: what about the .spec file? Is it only needed for RPM creation?
install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal") install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
endif(NOT WINDOWS OR CYGWIN) endif()