cmake: Set debug library name suffix per target instead of setting it globally. Don't add a suffix on android
authorOlli Kallioinen <olli.kallioinen@iki.fi>
Sun, 25 Feb 2018 19:22:47 +0200
changeset 1190443dbca2813e1
parent 11903 732b6ef4aae7
child 11905 29bf3038a246
cmake: Set debug library name suffix per target instead of setting it globally. Don't add a suffix on android
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sun Feb 25 10:15:00 2018 +0300
     1.2 +++ b/CMakeLists.txt	Sun Feb 25 19:22:47 2018 +0200
     1.3 @@ -48,10 +48,10 @@
     1.4  set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
     1.5  
     1.6  # Set defaults preventing destination file conflicts
     1.7 -set(CMAKE_DEBUG_POSTFIX "d"
     1.8 +set(SDL_CMAKE_DEBUG_POSTFIX "d"
     1.9      CACHE STRING "Name suffix for debug builds")
    1.10  
    1.11 -mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_DEBUG_POSTFIX)
    1.12 +mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX)
    1.13  
    1.14  # Calculate a libtool-like version number
    1.15  math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}")
    1.16 @@ -1697,6 +1697,9 @@
    1.17  add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
    1.18  target_include_directories(SDL2main PUBLIC $<INSTALL_INTERFACE:include>)
    1.19  set(_INSTALL_LIBS "SDL2main")
    1.20 +if (NOT ANDROID)
    1.21 +  set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
    1.22 +endif()
    1.23  
    1.24  if(SDL_SHARED)
    1.25    add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
    1.26 @@ -1722,6 +1725,9 @@
    1.27    set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
    1.28    target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
    1.29    target_include_directories(SDL2 PUBLIC $<INSTALL_INTERFACE:include>)
    1.30 +  if (NOT ANDROID)
    1.31 +    set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
    1.32 +  endif()
    1.33  endif()
    1.34  
    1.35  if(SDL_STATIC)
    1.36 @@ -1745,6 +1751,9 @@
    1.37    set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
    1.38    target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
    1.39    target_include_directories(SDL2-static PUBLIC $<INSTALL_INTERFACE:include>)
    1.40 +  if (NOT ANDROID)
    1.41 +    set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
    1.42 +  endif()
    1.43  endif()
    1.44  
    1.45  ##### Tests #####