cmake: fix installed SDL3::SDL3_test + test on ci
parent
72f40cb1f5
commit
0a3d038ff7
|
@ -3339,7 +3339,7 @@ if(NOT SDL_DISABLE_INSTALL)
|
|||
|
||||
set(SDL_SDLtest_INSTALL_RESOURCEDIR ".")
|
||||
set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
|
||||
set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3_testTargets.cmake")
|
||||
set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3testTargets.cmake")
|
||||
endif()
|
||||
|
||||
##### sdl3.pc #####
|
||||
|
|
|
@ -27,6 +27,9 @@ add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
|
|||
option(TEST_STATIC "Test linking to static SDL3 library" ON)
|
||||
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
|
||||
|
||||
option(TEST_TEST "Test linking to SDL3_test library" ON)
|
||||
add_feature_info("TEST_TEST" TEST_STATIC "Test linking to SDL test library")
|
||||
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS Headers)
|
||||
add_library(headers_test OBJECT inc_sdl_slash.c inc_sdl_noslash.c)
|
||||
target_link_libraries(headers_test PRIVATE SDL3::Headers)
|
||||
|
@ -54,6 +57,11 @@ if(TEST_SHARED)
|
|||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:SDL3::SDL3>" "$<TARGET_FILE_DIR:cli-shared>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TEST_TEST)
|
||||
add_executable(sdltest-shared sdltest.c)
|
||||
target_link_libraries(sdltest-shared PRIVATE SDL3::SDL3_test SDL3::SDL3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TEST_STATIC)
|
||||
|
@ -70,6 +78,10 @@ if(TEST_STATIC)
|
|||
set_target_properties(sharedlib-static PROPERTIES C_VISIBILITY_PRESET "hidden")
|
||||
endif()
|
||||
|
||||
if(TEST_TEST)
|
||||
add_executable(sdltest-static sdltest.c)
|
||||
target_link_libraries(sdltest-static PRIVATE SDL3::SDL3_test SDL3::SDL3-static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ALL)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
SDLTest_CommonState state;
|
||||
SDLTest_CommonDefaultArgs(&state, argc, argv);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue