File: FindSDL2test.cmake

package info (click to toggle)
libsdl2-net 2.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,596 kB
  • sloc: sh: 10,749; ansic: 1,802; makefile: 79
file content (31 lines) | stat: -rw-r--r-- 1,100 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# FIXME: this should be provided by SDL2

include(FindPackageHandleStandardArgs)
include("${CMAKE_CURRENT_LIST_DIR}/CommonFindSDL2.cmake")

find_library(SDL2_TEST_LIBRARY
    NAMES SDL2test SDL2_test
    HINTS ${SDL2_DIR} ENV SDL2_DIR
    PATH_SUFFIXES ${_lib_suffixes}
)

find_package_handle_standard_args(SDL2test
    REQUIRED_VARS SDL2_TEST_LIBRARY
)

if(SDL2test_FOUND)
    if(NOT TARGET SDL2::SDL2test)
        add_library(SDL2::SDL2test UNKNOWN IMPORTED)
        set_target_properties(SDL2::SDL2test PROPERTIES
            IMPORTED_LINK_INTERFACE_LANGUAGES "C"
            IMPORTED_LOCATION "${SDL2_TEST_LIBRARY}"
        )
        if(MSVC AND ((SDL2_VERSION AND SDL2_VERSION VERSION_LESS "2.0.20") OR NOT SDL2_VERSION))
            # FIXME: remove once minimum required SDL library is >=2.0.20
            # Until 2.0.18, SDL2test.lib used `printf` in SDL_test_common.c. instead of `SDL_log`. (fixed in 2.0.20)
            set_target_properties(SDL2::SDL2test PROPERTIES
                INTERFACE_LINK_LIBRARIES "legacy_stdio_definitions.lib"
            )
        endif()
    endif()
endif()