Skip to content

Commit bda90c3

Browse files
committed
cmake: rename SDL_DISABLE_* CMake options to SDL_xxx
1 parent 90aff30 commit bda90c3

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

.github/workflows/generic.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ jobs:
170170
-DSDLTEST_TRACKMEM=ON \
171171
-DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \
172172
-DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \
173-
-DSDL_DISABLE_INSTALL_DOCS=OFF \
174-
-DSDL_DISABLE_INSTALL_CPACK=OFF \
175-
-DSDL_DISABLE_INSTALL_DOCS=OFF \
173+
-DSDL_INSTALL_DOCS=ON \
174+
-DSDL_INSTALL_CPACK=ON \
175+
-DSDL_INSTALL_DOCS=ON \
176176
${{ matrix.platform.cmake-arguments }} \
177177
-DSDL_SHARED=${{ matrix.platform.shared }} \
178178
-DSDL_STATIC=${{ matrix.platform.static }} \
@@ -293,7 +293,7 @@ jobs:
293293
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
294294
-Wdeprecated -Wdev -Werror \
295295
-DSDL_WERROR=${{ matrix.platform.werror }} \
296-
-DSDL_DISABLE_INSTALL_DOCS=OFF \
296+
-DSDL_INSTALL_DOCS=ON \
297297
${{ matrix.platform.cmake-arguments }} \
298298
-DSDL_SHARED=${{ matrix.platform.shared }} \
299299
-DSDL_STATIC=${{ matrix.platform.static }} \

CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ endif()
88
project(SDL3 LANGUAGES C VERSION "3.1.9")
99

1010
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
11-
set(SDL3_SUBPROJECT OFF)
11+
set(SDL3_MAINPROJECT ON)
1212
else()
13-
set(SDL3_SUBPROJECT ON)
13+
set(SDL3_MAINPROJECT OFF)
1414
endif()
1515

1616
# By default, configure SDL3 in RelWithDebInfo configuration
17-
if(NOT SDL3_SUBPROJECT)
17+
if(SDL3_MAINPROJECT)
1818
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
1919
if(is_multi_config)
2020
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
@@ -287,14 +287,14 @@ if(SOLARIS)
287287
endif()
288288

289289
# Allow some projects to be built conditionally.
290-
set_option(SDL_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT})
291-
cmake_dependent_option(SDL_DISABLE_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_SUBPROJECT} "NOT SDL_DISABLE_INSTALL" ON)
292-
cmake_dependent_option(SDL_DISABLE_INSTALL_DOCS "Install docs for SDL3" ON "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" ON)
293-
set_option(SDL_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF)
290+
set_option(SDL_INSTALL "Enable installation of SDL3" ${SDL3_MAINPROJECT})
291+
cmake_dependent_option(SDL_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_MAINPROJECT} "SDL_INSTALL" ON)
292+
cmake_dependent_option(SDL_INSTALL_DOCS "Install docs for SDL3" OFF "SDL_INSTALL;NOT SDL_FRAMEWORK" ON)
293+
set_option(SDL_UNINSTALL "Enable uninstallation of SDL3" ${SDL3_MAINPROJECT})
294294
cmake_dependent_option(SDL_PRESEED "Preseed CMake cache to speed up configuration" ON "${SDL_PRESEED_AVAILABLE}" OFF)
295-
cmake_dependent_option(SDL_RELOCATABLE "Create relocatable SDL package" ${SDL_RELOCATABLE_DEFAULT} "NOT SDL_DISABLE_INSTALL" OFF)
295+
cmake_dependent_option(SDL_RELOCATABLE "Create relocatable SDL package" ${SDL_RELOCATABLE_DEFAULT} "SDL_INSTALL" OFF)
296296

297-
cmake_dependent_option(SDL_DISABLE_ANDROID_JAR "Disable creation of SDL3.jar" ${SDL3_SUBPROJECT} "ANDROID" ON)
297+
cmake_dependent_option(SDL_ANDROID_JAR "Enable creation of SDL3.jar" ${SDL3_MAINPROJECT} "ANDROID" ON)
298298

299299
option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
300300
set_option(SDL_ASSEMBLY "Enable assembly routines" ${SDL_ASSEMBLY_DEFAULT})
@@ -394,7 +394,7 @@ cmake_dependent_option(SDL_STATIC "Build a static version of the library" ${SDL_
394394
option(SDL_TEST_LIBRARY "Build the SDL3_test library" ON)
395395

396396
dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST_LIBRARY OFF)
397-
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF)
397+
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "SDL_INSTALL;NOT SDL_FRAMEWORK" OFF)
398398
dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}")
399399
set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines")
400400

@@ -1419,7 +1419,7 @@ if(ANDROID)
14191419
set(HAVE_CLOCK_GETTIME 1)
14201420
endif()
14211421

1422-
if(NOT SDL_DISABLE_ANDROID_JAR)
1422+
if(SDL_ANDROID_JAR)
14231423
find_package(Java)
14241424
find_package(SdlAndroidPlatform MODULE)
14251425

@@ -1449,7 +1449,7 @@ if(ANDROID)
14491449
DEPENDS ${SDL_JAVA_SOURCES}
14501450
)
14511451
add_custom_target(SDL3-javasources ALL DEPENDS "${javasourcesjar}")
1452-
if(NOT SDL_DISABLE_INSTALL_DOCS)
1452+
if(SDL_INSTALL_DOCS)
14531453
set(javadocdir "${SDL3_BINARY_DIR}/docs/javadoc")
14541454
set(javadocjar "${SDL3_BINARY_DIR}/SDL3-${SDL3_VERSION}-javadoc.jar")
14551455
set(javadoc_index_html "${javadocdir}/index.html")
@@ -3609,7 +3609,7 @@ if(sdl_cmake_modules)
36093609
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${sdl_cmake_modules} "${SDL3_BINARY_DIR}")
36103610
endif()
36113611

3612-
if(NOT SDL_DISABLE_INSTALL)
3612+
if(SDL_INSTALL)
36133613

36143614
##### sdl3.pc #####
36153615
configure_sdl3_pc()
@@ -3709,7 +3709,7 @@ if(NOT SDL_DISABLE_INSTALL)
37093709
install(FILES "LICENSE.txt" DESTINATION "${SDL_INSTALL_LICENSEDIR}")
37103710
endif()
37113711

3712-
if(NOT SDL_DISABLE_INSTALL_CPACK)
3712+
if(SDL_INSTALL_CPACK)
37133713
if(SDL_FRAMEWORK)
37143714
set(CPACK_GENERATOR "DragNDrop")
37153715
elseif(MSVC)
@@ -3750,7 +3750,7 @@ if(NOT SDL_DISABLE_INSTALL)
37503750
endif()
37513751
endif()
37523752

3753-
if(NOT SDL_DISABLE_INSTALL_DOCS)
3753+
if(SDL_INSTALL_DOCS)
37543754
SDL_generate_manpages(
37553755
HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/SDL3"
37563756
SYMBOL "SDL_Init"
@@ -3767,7 +3767,7 @@ endif()
37673767

37683768
##### Uninstall target #####
37693769

3770-
if(NOT SDL_DISABLE_UNINSTALL)
3770+
if(SDL_UNINSTALL)
37713771
if(NOT TARGET uninstall)
37723772
configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY)
37733773

docs/README-cmake.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ Exceptions exist:
131131
- some platforms don't support dynamic libraries, so only `-DSDL_STATIC=ON` makes sense.
132132
- a static Apple framework is not supported
133133

134+
### Man pages
135+
136+
Configuring with `-DSDL_INSTALL_DOCS=TRUE` installs man pages.
137+
138+
We recommend package managers of unix distributions to install SDL3's man pages.
139+
This adds an extra build-time dependency on Perl.
140+
134141
### Pass custom compile options to the compiler
135142

136143
- Use [`CMAKE_<LANG>_FLAGS`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) to pass extra

0 commit comments

Comments
 (0)