CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Mon, 18 Feb 2019 00:26:53 -0500
changeset 69 a2c5f6a01a55
parent 45 2c4484212926
permissions -rw-r--r--
Fill in a default palette for 8-bit screen surfaces.
icculus@45
     1
cmake_minimum_required(VERSION 3.0.0)
icculus@45
     2
project(sdl12_compat)
icculus@45
     3
icculus@45
     4
add_library(SDL SHARED "src/SDL12_compat.c")
icculus@45
     5
icculus@45
     6
target_include_directories(SDL PUBLIC "/usr/local/include/SDL2")  # !!! FIXME
icculus@45
     7
target_include_directories(SDL PUBLIC "/usr/X11/include")  # !!! FIXME
icculus@45
     8
add_definitions("-D_THREAD_SAFE")  # !!! FIXME
icculus@45
     9
icculus@45
    10
if(APPLE)
icculus@45
    11
    set_target_properties(SDL PROPERTIES
icculus@45
    12
        MACOSX_RPATH 1
icculus@45
    13
        OUTPUT_NAME "SDL-1.2.0"
icculus@45
    14
    )
icculus@45
    15
elseif(UNIX AND NOT ANDROID)
icculus@45
    16
    set_target_properties(SDL PROPERTIES
icculus@45
    17
        VERSION "1.2.50"
icculus@45
    18
        SOVERSION "0"
icculus@45
    19
        OUTPUT_NAME "SDL-1.2")
icculus@45
    20
else()
icculus@45
    21
    set_target_properties(SDL PROPERTIES
icculus@45
    22
        VERSION "1.2.50"
icculus@45
    23
        SOVERSION "0"
icculus@45
    24
      OUTPUT_NAME "SDL")
icculus@45
    25
endif()
icculus@45
    26
icculus@45
    27
if(MSVC)
icculus@45
    28
    # Don't try to link with the default set of libraries.
icculus@45
    29
    set_target_properties(SDL PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
icculus@45
    30
    set_target_properties(SDL PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
icculus@45
    31
    set_target_properties(SDL PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
icculus@45
    32
endif()
icculus@45
    33
icculus@45
    34
icculus@45
    35
# test programs...
icculus@45
    36
macro(test_program _NAME _SRCS)
icculus@45
    37
    add_executable(${_NAME} ${_SRCS})
icculus@45
    38
    target_include_directories(${_NAME} PUBLIC "/usr/local/include/SDL")  # !!! FIXME
icculus@45
    39
    target_include_directories(${_NAME} PUBLIC "/usr/X11/include")  # !!! FIXME
icculus@45
    40
    target_link_libraries(${_NAME} SDL)
icculus@45
    41
endmacro()
icculus@45
    42
icculus@45
    43
test_program(testsprite "test/testsprite.c")