Use ON and OFF for CMake booleans

This commit is contained in:
Chris Thrasher committed 2024-09-11 14:36:23 -06:00
1 parent 33fca5fd5d
commit 574c6afe05
4 files changed
+31 -31

No files matched your search

+1 -1
View File
@@ -105,7 +105,7 @@ jobs:
path: SFML path: SFML
- name: Configure SFML CMake - name: Configure SFML CMake
run: cmake -S SFML -B SFML/build -GNinja -DCMAKE_INSTALL_PREFIX=SFML/install -DBUILD_SHARED_LIBS=TRUE -DCMAKE_BUILD_TYPE=Debug run: cmake -S SFML -B SFML/build -GNinja -DCMAKE_INSTALL_PREFIX=SFML/install -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug
- name: Build SFML - name: Build SFML
run: cmake --build SFML/build --target install run: cmake --build SFML/build --target install
+16 -16
View File
@@ -24,34 +24,34 @@ include(GNUInstallDirs)
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake) include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
# add options to select which modules to build # add options to select which modules to build
csfml_set_option(CSFML_BUILD_WINDOW TRUE BOOL "TRUE to build CSFML's Window module. This setting is ignored, if the graphics module is built.") csfml_set_option(CSFML_BUILD_WINDOW ON BOOL "ON to build CSFML's Window module. This setting is ignored, if the graphics module is built.")
csfml_set_option(CSFML_BUILD_GRAPHICS TRUE BOOL "TRUE to build CSFML's Graphics module.") csfml_set_option(CSFML_BUILD_GRAPHICS ON BOOL "ON to build CSFML's Graphics module.")
csfml_set_option(CSFML_BUILD_AUDIO TRUE BOOL "TRUE to build CSFML's Audio module.") csfml_set_option(CSFML_BUILD_AUDIO ON BOOL "ON to build CSFML's Audio module.")
csfml_set_option(CSFML_BUILD_NETWORK TRUE BOOL "TRUE to build CSFML's Network module.") csfml_set_option(CSFML_BUILD_NETWORK ON BOOL "ON to build CSFML's Network module.")
# add an option for choosing the build type (shared or static) # add an option for choosing the build type (shared or static)
csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries") csfml_set_option(BUILD_SHARED_LIBS ON BOOL "ON to build CSFML as shared libraries, OFF to build it as static libraries")
# add an option for building the API documentation # add an option for building the API documentation
csfml_set_option(CSFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it") csfml_set_option(CSFML_BUILD_DOC OFF BOOL "ON to generate the API documentation, OFF to ignore it")
# add an option for linking to sfml either statically or dynamically # add an option for linking to sfml either statically or dynamically
# default on windows to static and on other platforms to dynamic # default on windows to static and on other platforms to dynamic
if(SFML_OS_WINDOWS) if(SFML_OS_WINDOWS)
set(LINK_STATICALLY_DEFAULT TRUE) set(LINK_STATICALLY_DEFAULT ON)
else() else()
set(LINK_STATICALLY_DEFAULT FALSE) set(LINK_STATICALLY_DEFAULT OFF)
endif() endif()
csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "TRUE to link to a static version of SFML, FALSE to link dynamically") csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "ON to link to a static version of SFML, OFF to link dynamically")
# define an option for choosing between static and dynamic C runtime (Windows only) # define an option for choosing between static and dynamic C runtime (Windows only)
if(SFML_OS_WINDOWS) if(SFML_OS_WINDOWS)
set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs") set(STATIC_STD_LIBS OFF CACHE BOOL "ON to statically link to the standard libraries, OFF to use them as DLLs")
endif() endif()
# find SFML libraries (C++) # find SFML libraries (C++)
if(CSFML_LINK_SFML_STATICALLY) if(CSFML_LINK_SFML_STATICALLY)
set(SFML_STATIC_LIBRARIES TRUE) set(SFML_STATIC_LIBRARIES ON)
add_definitions(-DSFML_STATIC) add_definitions(-DSFML_STATIC)
endif() endif()
set(SFML_MODULES "System") set(SFML_MODULES "System")
@@ -76,13 +76,13 @@ if(CSFML_BUILD_DOC)
endif() endif()
# on Linux and BSD-like OS, install pkg-config files by default # on Linux and BSD-like OS, install pkg-config files by default
set(CSFML_INSTALL_PKGCONFIG_DEFAULT FALSE) set(CSFML_INSTALL_PKGCONFIG_DEFAULT OFF)
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
set(CSFML_INSTALL_PKGCONFIG_DEFAULT TRUE) set(CSFML_INSTALL_PKGCONFIG_DEFAULT ON)
endif() endif()
csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML") csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "ON to automatically install pkg-config files so other projects can find SFML")
if(CSFML_INSTALL_PKGCONFIG_FILES) if(CSFML_INSTALL_PKGCONFIG_FILES)
csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files") csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
@@ -110,13 +110,13 @@ if(NOT PROJECT_IS_TOP_LEVEL)
endif() endif()
# add an option for building the examples # add an option for building the examples
csfml_set_option(CSFML_BUILD_EXAMPLES FALSE BOOL "TRUE to build the CSFML examples, FALSE to ignore them") csfml_set_option(CSFML_BUILD_EXAMPLES OFF BOOL "ON to build the CSFML examples, OFF to ignore them")
if(CSFML_BUILD_EXAMPLES) if(CSFML_BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif() endif()
# add an option for building the tests # add an option for building the tests
csfml_set_option(CSFML_BUILD_TEST_SUITE FALSE BOOL "TRUE to build the CSFML test suite, FALSE to ignore it") csfml_set_option(CSFML_BUILD_TEST_SUITE OFF BOOL "ON to build the CSFML test suite, OFF to ignore it")
if(CSFML_BUILD_TEST_SUITE) if(CSFML_BUILD_TEST_SUITE)
enable_testing() enable_testing()
add_subdirectory(test) add_subdirectory(test)
+2 -2
View File
@@ -4,7 +4,7 @@
# Helper function to enable compiler warnings for a specific target # Helper function to enable compiler warnings for a specific target
function(set_target_warnings target) function(set_target_warnings target)
option(CSFML_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" FALSE) option(CSFML_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
set(MSVC_WARNINGS set(MSVC_WARNINGS
/W4 # Baseline reasonable warnings /W4 # Baseline reasonable warnings
@@ -55,7 +55,7 @@ function(set_target_warnings target)
# Disable warnings as errors when using Clang on Windows to work around deprecation warnings in Windows APIs # Disable warnings as errors when using Clang on Windows to work around deprecation warnings in Windows APIs
if(SFML_OS_WINDOWS AND (SFML_COMPILER_CLANG OR SFML_COMPILER_CLANG_CL)) if(SFML_OS_WINDOWS AND (SFML_COMPILER_CLANG OR SFML_COMPILER_CLANG_CL))
set(CSFML_WARNINGS_AS_ERRORS FALSE) set(CSFML_WARNINGS_AS_ERRORS OFF)
endif() endif()
if(CSFML_WARNINGS_AS_ERRORS) if(CSFML_WARNINGS_AS_ERRORS)
+12 -12
View File
@@ -220,11 +220,11 @@ build_sfml () # $1: 'clang' => clang & libc++
case "$2" in case "$2" in
'frameworks') 'frameworks')
frameworks="TRUE" frameworks="ON"
installdir_adapted="$installdir/Library/Frameworks" installdir_adapted="$installdir/Library/Frameworks"
;; ;;
'dylibs') 'dylibs')
frameworks="FALSE" frameworks="OFF"
installdir_adapted="$installdir/usr/local" installdir_adapted="$installdir/usr/local"
;; ;;
*) *)
@@ -234,10 +234,10 @@ build_sfml () # $1: 'clang' => clang & libc++
case "$3" in case "$3" in
'doc') 'doc')
doc="TRUE" doc="ON"
;; ;;
'no doc') 'no doc')
doc="FALSE" doc="OFF"
;; ;;
*) *)
error "Unknown option for $3 in create_makefile" error "Unknown option for $3 in create_makefile"
@@ -246,12 +246,12 @@ build_sfml () # $1: 'clang' => clang & libc++
case "$4" in case "$4" in
'examples') 'examples')
examples="TRUE" examples="ON"
makeopts="" makeopts=""
# NB: cannot use -j8 here because it bugs with cocoa example... # NB: cannot use -j8 here because it bugs with cocoa example...
;; ;;
'no examples') 'no examples')
examples="FALSE" examples="OFF"
makeopts="-j8" makeopts="-j8"
;; ;;
*) *)
@@ -261,10 +261,10 @@ build_sfml () # $1: 'clang' => clang & libc++
case "$5" in case "$5" in
'templates') 'templates')
templates="TRUE" templates="ON"
;; ;;
'no templates') 'no templates')
templates="FALSE" templates="OFF"
;; ;;
*) *)
error "Unknown option for $5 in create_makefile" error "Unknown option for $5 in create_makefile"
@@ -285,7 +285,7 @@ build_sfml () # $1: 'clang' => clang & libc++
push_pwd "$cmakedir" push_pwd "$cmakedir"
cmake -G "Unix Makefiles" \ cmake -G "Unix Makefiles" \
-D "BUILD_SHARED_LIBS:BOOL=TRUE" \ -D "BUILD_SHARED_LIBS:BOOL=ON" \
-D "CMAKE_BUILD_TYPE:STRING=Release" \ -D "CMAKE_BUILD_TYPE:STRING=Release" \
-D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \ -D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \
-D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \ -D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \
@@ -334,10 +334,10 @@ build_csfml () # $1: 'clang' => clang & libc++
case "$2" in case "$2" in
'doc') 'doc')
doc="TRUE" doc="ON"
;; ;;
'no doc') 'no doc')
doc="FALSE" doc="OFF"
;; ;;
*) *)
error "Unknown option for $2 in create_makefile" error "Unknown option for $2 in create_makefile"
@@ -360,7 +360,7 @@ build_csfml () # $1: 'clang' => clang & libc++
push_pwd "$cmakedir" push_pwd "$cmakedir"
cmake -G "Unix Makefiles" \ cmake -G "Unix Makefiles" \
-D "BUILD_SHARED_LIBS:BOOL=TRUE" \ -D "BUILD_SHARED_LIBS:BOOL=ON" \
-D "CMAKE_BUILD_TYPE:STRING=Release" \ -D "CMAKE_BUILD_TYPE:STRING=Release" \
-D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \ -D "CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/$cxx" \
-D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \ -D "CMAKE_CXX_FLAGS:STRING=$cxx_flags" \