Skip to content

Commit

Permalink
cmake: rename SDL_TEST -> SDL_TEST_LIBRARY
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Jul 28, 2023
1 parent b64f378 commit 9ba59ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
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_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_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")
Expand Down Expand Up @@ -391,7 +391,7 @@ if(SDL_STATIC)
target_compile_features(SDL3-static PRIVATE c_std_99)
endif()

if(SDL_TEST)
if(SDL_TEST_LIBRARY)
add_library(SDL3_test STATIC)
add_library(SDL3::SDL3_test ALIAS SDL3_test)
SDL_AddCommonCompilerFlags(SDL3_test)
Expand Down Expand Up @@ -3135,7 +3135,7 @@ sdl_compile_definitions(

##### Tests #####

if(SDL_TEST)
if(SDL_TEST_LIBRARY)
file(GLOB TEST_SOURCES "${SDL3_SOURCE_DIR}/src/test/*.c")
target_sources(SDL3_test PRIVATE ${TEST_SOURCES})
if(APPLE)
Expand Down Expand Up @@ -3227,7 +3227,7 @@ if(SDL_STATIC)
export(TARGETS SDL3-static NAMESPACE "SDL3::" FILE "SDL3staticTargets.cmake")
endif()

if(SDL_TEST)
if(SDL_TEST_LIBRARY)
export(TARGETS SDL3_test NAMESPACE "SDL3::" FILE "SDL3testTargets.cmake")
endif()

Expand Down Expand Up @@ -3285,7 +3285,7 @@ if(NOT SDL_DISABLE_INSTALL)
)
endif()

if(SDL_TEST)
if(SDL_TEST_LIBRARY)
install(TARGETS SDL3_test EXPORT SDL3testTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FRAMEWORK DESTINATION "."
Expand Down Expand Up @@ -3317,7 +3317,7 @@ if(NOT SDL_DISABLE_INSTALL)
)
endif()

if(SDL_TEST)
if(SDL_TEST_LIBRARY)
install(EXPORT SDL3testTargets
FILE "${SDL_SDLtest_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3::
Expand All @@ -3336,7 +3336,7 @@ if(NOT SDL_DISABLE_INSTALL)
install(FILES ${SDL3_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
)
if(SDL_TEST)
if(SDL_TEST_LIBRARY)
install(FILES ${SDL3_TEST_INCLUDE_FILES}
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
)
Expand Down
6 changes: 3 additions & 3 deletions docs/README-cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```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/`.

Expand Down Expand Up @@ -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_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_TESTS=` | `ON`/`OFF` | Build SDL test programs (**requires `-DSDL_TEST=ON`**) |
| `-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_LIBRARY=ON`**) |
| `-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_INSTALL_TESTS=` | `ON`/`OFF` | Install the SDL test programs |
Expand Down

0 comments on commit 9ba59ab

Please sign in to comment.