From 79ff68efa32650cccaa42c0053af8b30f8ce48ab Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 18 Mar 2016 22:40:41 -0300 Subject: [PATCH] Applied previous megasource-specific changes to SDL's cmakelists: * Enable SDL_SHARED. * Disable SDL_STATIC. * Set SDL_LINK_DIR in parent scope. * Use custom install() directive. * Add target_include_directories. --- libs/SDL2/CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/SDL2/CMakeLists.txt b/libs/SDL2/CMakeLists.txt index 54571ff0..47d94fb2 100644 --- a/libs/SDL2/CMakeLists.txt +++ b/libs/SDL2/CMakeLists.txt @@ -309,8 +309,8 @@ set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. -set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") -set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") +set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library") +set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library") dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) @@ -992,6 +992,8 @@ elseif(WINDOWS) endif() endif() + set(SDL_LINK_DIR ${PARENT_SCOPE}) + # Check for DirectX if(DIRECTX) if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) @@ -1025,13 +1027,15 @@ elseif(WINDOWS) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks - link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}) + set(SDL_LINK_DIR $ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH} ${SDL_LINK_DIR}) include_directories($ENV{DXSDK_DIR}\\Include) endif() endif() set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() + link_directories(${SDL_LINK_DIR}) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_WINMM 1) file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) @@ -1492,6 +1496,7 @@ set(_INSTALL_LIBS "SDL2main") if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES}) + install(TARGETS SDL2 RUNTIME DESTINATION . LIBRARY DESTINATION .) if(UNIX) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} @@ -1511,6 +1516,7 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2 PUBLIC include) endif() if(SDL_STATIC) @@ -1530,6 +1536,11 @@ if(SDL_STATIC) endif() ##### Installation targets ##### + +if(MEGA) + return() +endif() + install(TARGETS ${_INSTALL_LIBS} LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}"