CMakeLists.txt
changeset 11904 43dbca2813e1
parent 11901 e4d03d8733f3
child 11927 6e61fc35c129
equal deleted inserted replaced
11903:732b6ef4aae7 11904:43dbca2813e1
    46 set(SDL_INTERFACE_AGE 0)
    46 set(SDL_INTERFACE_AGE 0)
    47 set(SDL_BINARY_AGE 8)
    47 set(SDL_BINARY_AGE 8)
    48 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
    48 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
    49 
    49 
    50 # Set defaults preventing destination file conflicts
    50 # Set defaults preventing destination file conflicts
    51 set(CMAKE_DEBUG_POSTFIX "d"
    51 set(SDL_CMAKE_DEBUG_POSTFIX "d"
    52     CACHE STRING "Name suffix for debug builds")
    52     CACHE STRING "Name suffix for debug builds")
    53 
    53 
    54 mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_DEBUG_POSTFIX)
    54 mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX)
    55 
    55 
    56 # Calculate a libtool-like version number
    56 # Calculate a libtool-like version number
    57 math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}")
    57 math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}")
    58 math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}")
    58 math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}")
    59 math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}")
    59 math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}")
  1695 
  1695 
  1696 # Always build SDLmain
  1696 # Always build SDLmain
  1697 add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
  1697 add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
  1698 target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include>)
  1698 target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include>)
  1699 set(_INSTALL_LIBS "SDL2main")
  1699 set(_INSTALL_LIBS "SDL2main")
       
  1700 if (NOT ANDROID)
       
  1701   set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
       
  1702 endif()
  1700 
  1703 
  1701 if(SDL_SHARED)
  1704 if(SDL_SHARED)
  1702   add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
  1705   add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
  1703   if(APPLE)
  1706   if(APPLE)
  1704     set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1)
  1707     set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1)
  1720     set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
  1723     set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
  1721   endif()
  1724   endif()
  1722   set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
  1725   set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
  1723   target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1726   target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1724   target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include>)
  1727   target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include>)
       
  1728   if (NOT ANDROID)
       
  1729     set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
       
  1730   endif()
  1725 endif()
  1731 endif()
  1726 
  1732 
  1727 if(SDL_STATIC)
  1733 if(SDL_STATIC)
  1728   set (BUILD_SHARED_LIBS FALSE)
  1734   set (BUILD_SHARED_LIBS FALSE)
  1729   add_library(SDL2-static STATIC ${SOURCE_FILES})
  1735   add_library(SDL2-static STATIC ${SOURCE_FILES})
  1743   # TODO: Win32 platforms keep the same suffix .lib for import and static
  1749   # TODO: Win32 platforms keep the same suffix .lib for import and static
  1744   # libraries - do we need to consider this?
  1750   # libraries - do we need to consider this?
  1745   set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
  1751   set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
  1746   target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1752   target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1747   target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include>)
  1753   target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include>)
       
  1754   if (NOT ANDROID)
       
  1755     set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
       
  1756   endif()
  1748 endif()
  1757 endif()
  1749 
  1758 
  1750 ##### Tests #####
  1759 ##### Tests #####
  1751 
  1760 
  1752 if(SDL_TEST)
  1761 if(SDL_TEST)