cmake: rename SDL_TEST -> SDL_TEST_LIBRARY

main
Anonymous Maarten 2023-07-28 01:51:01 +02:00 committed by Anonymous Maarten
parent da5016d336
commit e24b3e2fa4
2 changed files with 11 additions and 11 deletions

View File

@ -355,13 +355,13 @@ set(SDL_VENDOR_INFO "" CACHE STRING "Vendor name and/or version to add to SDL_RE
cmake_dependent_option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_DEFAULT} ${SDL_SHARED_AVAILABLE} OFF) cmake_dependent_option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_DEFAULT} ${SDL_SHARED_AVAILABLE} OFF)
option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_DEFAULT}) option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_DEFAULT})
option(SDL_TEST "Build the SDL3_test library" ON) option(SDL_TEST_LIBRARY "Build the SDL3_test library" ON)
# Apple Frameworks NEED a (shared) SDL3.framework for `#include <SDL3/xxx.h>` to work # Apple Frameworks NEED a (shared) SDL3.framework for `#include <SDL3/xxx.h>` to work
cmake_dependent_option(SDL_FRAMEWORK "Build SDL libraries as Apple Framework" OFF "SDL_SHARED;APPLE" OFF) cmake_dependent_option(SDL_FRAMEWORK "Build SDL libraries as Apple Framework" OFF "SDL_SHARED;APPLE" OFF)
dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF) dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF)
dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF) dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST_LIBRARY OFF)
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF) dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF)
dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}") dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}")
set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines") set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines")
@ -391,7 +391,7 @@ if(SDL_STATIC)
target_compile_features(SDL3-static PRIVATE c_std_99) target_compile_features(SDL3-static PRIVATE c_std_99)
endif() endif()
if(SDL_TEST) if(SDL_TEST_LIBRARY)
add_library(SDL3_test STATIC) add_library(SDL3_test STATIC)
add_library(SDL3::SDL3_test ALIAS SDL3_test) add_library(SDL3::SDL3_test ALIAS SDL3_test)
SDL_AddCommonCompilerFlags(SDL3_test) SDL_AddCommonCompilerFlags(SDL3_test)
@ -3135,7 +3135,7 @@ sdl_compile_definitions(
##### Tests ##### ##### Tests #####
if(SDL_TEST) if(SDL_TEST_LIBRARY)
file(GLOB TEST_SOURCES "${SDL3_SOURCE_DIR}/src/test/*.c") file(GLOB TEST_SOURCES "${SDL3_SOURCE_DIR}/src/test/*.c")
target_sources(SDL3_test PRIVATE ${TEST_SOURCES}) target_sources(SDL3_test PRIVATE ${TEST_SOURCES})
if(APPLE) if(APPLE)
@ -3227,7 +3227,7 @@ if(SDL_STATIC)
export(TARGETS SDL3-static NAMESPACE "SDL3::" FILE "SDL3staticTargets.cmake") export(TARGETS SDL3-static NAMESPACE "SDL3::" FILE "SDL3staticTargets.cmake")
endif() endif()
if(SDL_TEST) if(SDL_TEST_LIBRARY)
export(TARGETS SDL3_test NAMESPACE "SDL3::" FILE "SDL3testTargets.cmake") export(TARGETS SDL3_test NAMESPACE "SDL3::" FILE "SDL3testTargets.cmake")
endif() endif()
@ -3285,7 +3285,7 @@ if(NOT SDL_DISABLE_INSTALL)
) )
endif() endif()
if(SDL_TEST) if(SDL_TEST_LIBRARY)
install(TARGETS SDL3_test EXPORT SDL3testTargets install(TARGETS SDL3_test EXPORT SDL3testTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FRAMEWORK DESTINATION "." FRAMEWORK DESTINATION "."
@ -3317,7 +3317,7 @@ if(NOT SDL_DISABLE_INSTALL)
) )
endif() endif()
if(SDL_TEST) if(SDL_TEST_LIBRARY)
install(EXPORT SDL3testTargets install(EXPORT SDL3testTargets
FILE "${SDL_SDLtest_INSTALL_CMAKEFILENAME}" FILE "${SDL_SDLtest_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3:: NAMESPACE SDL3::
@ -3336,7 +3336,7 @@ if(NOT SDL_DISABLE_INSTALL)
install(FILES ${SDL3_INCLUDE_FILES} install(FILES ${SDL3_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
) )
if(SDL_TEST) if(SDL_TEST_LIBRARY)
install(FILES ${SDL3_TEST_INCLUDE_FILES} install(FILES ${SDL3_TEST_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
) )

View File

@ -39,7 +39,7 @@ This will install SDL to /usr/local.
You can build the SDL test programs by adding `-DSDL_TESTS=ON` to the first cmake command above: You can build the SDL test programs by adding `-DSDL_TESTS=ON` to the first cmake command above:
```sh ```sh
cmake -S ~/sdl -B ~/build -DSDL_TEST=ON -DSDL_TESTS=ON cmake -S ~/sdl -B ~/build -DSDL_TEST_LIBRARY=ON -DSDL_TESTS=ON
``` ```
and then building normally. In this example, the test programs will be built and can be run from `~/build/tests/`. and then building normally. In this example, the test programs will be built and can be run from `~/build/tests/`.
@ -215,8 +215,8 @@ At the end of SDL CMake configuration, a table shows all CMake options along wit
|-------------------------------|--------------|-----------------------------------------------------------------------------------------------------| |-------------------------------|--------------|-----------------------------------------------------------------------------------------------------|
| `-DSDL_SHARED=` | `ON`/`OFF` | Build SDL shared library (not all platforms support this) (`libSDL3.so`/`libSDL3.dylib`/`SDL3.dll`) | | `-DSDL_SHARED=` | `ON`/`OFF` | Build SDL shared library (not all platforms support this) (`libSDL3.so`/`libSDL3.dylib`/`SDL3.dll`) |
| `-DSDL_STATIC=` | `ON`/`OFF` | Build SDL static library (`libSDL3.a`/`SDL3-static.lib`) | | `-DSDL_STATIC=` | `ON`/`OFF` | Build SDL static library (`libSDL3.a`/`SDL3-static.lib`) |
| `-DSDL_TEST=` | `ON`/`OFF` | Build SDL test library (`libSDL3_test.a`/`SDL3_test.lib`) | | `-DSDL_TEST_LIBRARY=` | `ON`/`OFF` | Build SDL test library (`libSDL3_test.a`/`SDL3_test.lib`) |
| `-DSDL_TESTS=` | `ON`/`OFF` | Build SDL test programs (**requires `-DSDL_TEST=ON`**) | | `-DSDL_TESTS=` | `ON`/`OFF` | Build SDL test programs (**requires `-DSDL_TEST_LIBRARY=ON`**) |
| `-DSDL_DISABLE_INSTALL=` | `ON`/`OFF` | Don't create a SDL install target | | `-DSDL_DISABLE_INSTALL=` | `ON`/`OFF` | Don't create a SDL install target |
| `-DSDL_DISABLE_INSTALL_DOCS=` | `ON`/`OFF` | Don't install the SDL documentation | | `-DSDL_DISABLE_INSTALL_DOCS=` | `ON`/`OFF` | Don't install the SDL documentation |
| `-DSDL_INSTALL_TESTS=` | `ON`/`OFF` | Install the SDL test programs | | `-DSDL_INSTALL_TESTS=` | `ON`/`OFF` | Install the SDL test programs |