You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CMake supports a number of strings for truthy and falsey values.
ON/OFF and TRUE/FALSE are the most popular but 1/0 is also supported.
This is mostly a style choice but I'm inclined to believe that ON/OFF
is the most popular option and I'm generally in favor of style
choices that better align with the community at large.
- { name: Windows VS2022 ClangCL MSBuild, os: windows-2022, flags: -DSFML_USE_MESA3D=TRUE -T ClangCL } # ninja doesn't support specifying the toolset, so use the ClangCL toolset to test building with MSBuild as well
- { name: Windows VS2022 ClangCL MSBuild, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -T ClangCL } # ninja doesn't support specifying the toolset, so use the ClangCL toolset to test building with MSBuild as well
Copy file name to clipboardExpand all lines: CMakeLists.txt
+28-28Lines changed: 28 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -43,37 +43,37 @@ include(GNUInstallDirs)
43
43
44
44
# disable static libraries on Android
45
45
if(SFML_OS_ANDROID)
46
-
set(BUILD_SHARED_LIBSTRUE)
46
+
set(BUILD_SHARED_LIBSON)
47
47
endif()
48
48
49
49
# add options to select which modules to build
50
-
sfml_set_option(SFML_BUILD_WINDOWTRUEBOOL"TRUE to build SFML's Window module. This setting is ignored, if the graphics module is built.")
51
-
sfml_set_option(SFML_BUILD_GRAPHICSTRUEBOOL"TRUE to build SFML's Graphics module.")
52
-
sfml_set_option(SFML_BUILD_AUDIOTRUEBOOL"TRUE to build SFML's Audio module.")
53
-
sfml_set_option(SFML_BUILD_NETWORKTRUEBOOL"TRUE to build SFML's Network module.")
50
+
sfml_set_option(SFML_BUILD_WINDOWONBOOL"ON to build SFML's Window module. This setting is ignored, if the graphics module is built.")
51
+
sfml_set_option(SFML_BUILD_GRAPHICSONBOOL"ON to build SFML's Graphics module.")
52
+
sfml_set_option(SFML_BUILD_AUDIOONBOOL"ON to build SFML's Audio module.")
53
+
sfml_set_option(SFML_BUILD_NETWORKONBOOL"ON to build SFML's Network module.")
54
54
55
55
if(SFML_BUILD_WINDOW)
56
56
# add an option for choosing the OpenGL implementation
57
-
sfml_set_option(SFML_OPENGL_ES${OPENGL_ES}BOOL"TRUE to use an OpenGL ES implementation, FALSE to use a desktop OpenGL implementation")
57
+
sfml_set_option(SFML_OPENGL_ES${OPENGL_ES}BOOL"ON to use an OpenGL ES implementation, OFF to use a desktop OpenGL implementation")
58
58
59
59
# add an option for choosing whether to use the DRM windowing backend
60
60
if(SFML_OS_LINUX)
61
-
sfml_set_option(SFML_USE_DRMFALSEBOOL"TRUE to use DRM windowing backend")
61
+
sfml_set_option(SFML_USE_DRMOFFBOOL"ON to use DRM windowing backend")
62
62
endif()
63
63
endif()
64
64
65
65
# macOS specific options
66
66
if(SFML_OS_MACOS OR SFML_OS_IOS)
67
67
# add an option to build frameworks instead of dylibs (release only)
68
-
sfml_set_option(SFML_BUILD_FRAMEWORKSFALSEBOOL"TRUE to build SFML as frameworks libraries (release only), FALSE to build according to BUILD_SHARED_LIBS")
68
+
sfml_set_option(SFML_BUILD_FRAMEWORKSOFFBOOL"ON to build SFML as frameworks libraries (release only), OFF to build according to BUILD_SHARED_LIBS")
69
69
70
70
# add an option to automatically install Xcode templates
71
-
sfml_set_option(SFML_INSTALL_XCODE_TEMPLATESFALSEBOOL"TRUE to automatically install the Xcode templates, FALSE to do nothing about it. The templates are compatible with Xcode 4 and 5.")
71
+
sfml_set_option(SFML_INSTALL_XCODE_TEMPLATESOFFBOOL"ON to automatically install the Xcode templates, OFF to do nothing about it. The templates are compatible with Xcode 4 and 5.")
72
72
endif()
73
73
74
74
# Android options
75
75
if(SFML_OS_ANDROID)
76
-
sfml_set_option(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCKFALSEBOOL"TRUE to use an sf::Clock implementation which takes system sleep time into account (keeps advancing during suspension), FALSE to default to another available monotonic clock")
76
+
sfml_set_option(SFML_ANDROID_USE_SUSPEND_AWARE_CLOCKOFFBOOL"ON to use an sf::Clock implementation which takes system sleep time into account (keeps advancing during suspension), OFF to default to another available monotonic clock")
# force building sfml-window, if sfml-graphics module is built
104
104
if(SFML_BUILD_GRAPHICS ANDNOT SFML_BUILD_WINDOW)
105
105
message(WARNING"You're trying to build SFML's Graphics module without the Window module. Forcing building of the Window module as a dependency.")
106
-
set(SFML_BUILD_WINDOW TRUE)
106
+
set(SFML_BUILD_WINDOW ON)
107
107
endif()
108
108
109
109
# allow not using bundled dependencies with a switch
110
110
# (except for stb_image)
111
111
# yes this is horrible, but GLOB_RECURSE sucks
112
-
sfml_set_option(SFML_USE_SYSTEM_DEPSFALSEBOOL"TRUE to use system dependencies, FALSE to use the bundled ones.")
112
+
sfml_set_option(SFML_USE_SYSTEM_DEPSOFFBOOL"ON to use system dependencies, OFF to use the bundled ones.")
113
113
if(SFML_USE_SYSTEM_DEPS)
114
114
if(SFML_INSTALL_XCODE_TEMPLATES)
115
115
message(FATAL_ERROR"XCode templates installation cannot be used with the SFML_USE_SYSTEM_DEPS option (the bundled frameworks are required.)")
@@ -141,7 +141,7 @@ endif()
141
141
142
142
if(SFML_COMPILER_MSVC)
143
143
# add an option to choose whether PDB debug symbols should be generated (defaults to true when possible)
144
-
sfml_set_option(SFML_GENERATE_PDBTRUEBOOL"True to generate PDB debug symbols, FALSE otherwise.")
144
+
sfml_set_option(SFML_GENERATE_PDBONBOOL"True to generate PDB debug symbols, OFF otherwise.")
145
145
146
146
# if building using a compiler launcher, embed the MSVC debugging information to allow for caching
147
147
if(CMAKE_CXX_COMPILER_LAUNCHER)
@@ -157,14 +157,14 @@ endif()
157
157
158
158
# define an option for choosing between static and dynamic C runtime (Windows only)
159
159
if(SFML_OS_WINDOWS)
160
-
sfml_set_option(SFML_USE_STATIC_STD_LIBSFALSEBOOL"TRUE to statically link to the standard libraries, FALSE to use them as DLLs")
160
+
sfml_set_option(SFML_USE_STATIC_STD_LIBSOFFBOOL"ON to statically link to the standard libraries, OFF to use them as DLLs")
161
161
162
162
# the following combination of flags is not valid
163
163
if(BUILD_SHARED_LIBSAND SFML_USE_STATIC_STD_LIBS)
164
164
message(FATAL_ERROR"BUILD_SHARED_LIBS and SFML_USE_STATIC_STD_LIBS cannot be used together")
165
165
endif()
166
166
167
-
sfml_set_option(SFML_USE_MESA3DFALSEBOOL"TRUE to use the Mesa 3D graphics library for rendering, FALSE to use the system provided library for rendering")
167
+
sfml_set_option(SFML_USE_MESA3DOFFBOOL"ON to use the Mesa 3D graphics library for rendering, OFF to use the system provided library for rendering")
168
168
169
169
include(cmake/Mesa3D.cmake)
170
170
endif()
@@ -178,13 +178,13 @@ if(SFML_OS_MACOS)
178
178
if(SFML_BUILD_FRAMEWORKS)
179
179
# requirement #1
180
180
if(NOTCMAKE_BUILD_TYPESTREQUAL"Release")
181
-
message(FATAL_ERROR"CMAKE_BUILD_TYPE should be \"Release\" when SFML_BUILD_FRAMEWORKS is TRUE")
181
+
message(FATAL_ERROR"CMAKE_BUILD_TYPE should be \"Release\" when SFML_BUILD_FRAMEWORKS is ON")
182
182
return()
183
183
endif()
184
184
185
185
# requirement #2
186
186
if(NOTBUILD_SHARED_LIBS)
187
-
message(FATAL_ERROR"BUILD_SHARED_LIBS should be TRUE when SFML_BUILD_FRAMEWORKS is TRUE")
187
+
message(FATAL_ERROR"BUILD_SHARED_LIBS should be ON when SFML_BUILD_FRAMEWORKS is ON")
# on Linux and BSD-like OS, install pkg-config files by default
223
-
set(SFML_INSTALL_PKGCONFIG_DEFAULT FALSE)
223
+
set(SFML_INSTALL_PKGCONFIG_DEFAULT OFF)
224
224
225
225
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
226
-
set(SFML_INSTALL_PKGCONFIG_DEFAULT TRUE)
226
+
set(SFML_INSTALL_PKGCONFIG_DEFAULT ON)
227
227
endif()
228
228
229
-
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES${SFML_INSTALL_PKGCONFIG_DEFAULT}BOOL"TRUE to automatically install pkg-config files so other projects can find SFML")
229
+
sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES${SFML_INSTALL_PKGCONFIG_DEFAULT}BOOL"ON to automatically install pkg-config files so other projects can find SFML")
230
230
231
231
if(SFML_INSTALL_PKGCONFIG_FILES)
232
232
# account for CMAKE_INSTALL_LIBDIR potentially being an absolute path
sfml_set_option(SFML_ENABLE_PCHFALSEBOOL"TRUE to enable precompiled headers for SFML builds -- only supported on Windows/Linux and for static library builds")
256
+
sfml_set_option(SFML_ENABLE_PCHOFFBOOL"ON to enable precompiled headers for SFML builds -- only supported on Windows/Linux and for static library builds")
257
257
258
258
if(SFML_ENABLE_PCH ANDBUILD_SHARED_LIBS)
259
259
message(FATAL_ERROR"Precompiled headers are currently not supported for shared library builds")
0 commit comments