From b7510fd09e187a496d3c485125daa9c36a1ba62e Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 7 Aug 2022 00:06:13 -0600 Subject: [PATCH] Fix formatting and style Use all lower_case commands with no space between the command name and the open parentheses. Don't repeat conditional in else() and endif() calls. --- cmake/Config.cmake | 4 ++-- cmake/Macros.cmake | 8 +++---- cmake/Modules/FindUDev.cmake | 42 ++++++++++++++++++------------------ test/CMakeLists.txt | 10 ++++----- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 6a60f5704..af724f779 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -52,8 +52,8 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(OPENGL_ES 0) # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.) - EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) - STRING(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") + exec_program(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) + string(REGEX REPLACE "10\\.([0-9]+).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") if(${MACOSX_VERSION} LESS 7) message(FATAL_ERROR "Unsupported version of OS X: ${MACOSX_VERSION_RAW}") return() diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index db1990ba6..09580a4dc 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -262,10 +262,10 @@ macro(sfml_add_example target) # For iOS apps we need the launch screen storyboard, # and a custom info.plist to use it - SET(LAUNCH_SCREEN "${CMAKE_SOURCE_DIR}/examples/assets/LaunchScreen.storyboard") - SET(LOGO "${CMAKE_SOURCE_DIR}/examples/assets/logo.png") - SET(INFO_PLIST "${CMAKE_SOURCE_DIR}/examples/assets/info.plist") - SET(ICONS "${CMAKE_SOURCE_DIR}/examples/assets/icon.icns") + set(LAUNCH_SCREEN "${CMAKE_SOURCE_DIR}/examples/assets/LaunchScreen.storyboard") + set(LOGO "${CMAKE_SOURCE_DIR}/examples/assets/logo.png") + set(INFO_PLIST "${CMAKE_SOURCE_DIR}/examples/assets/info.plist") + set(ICONS "${CMAKE_SOURCE_DIR}/examples/assets/icon.icns") add_executable(${target} MACOSX_BUNDLE ${target_input} ${LAUNCH_SCREEN} ${LOGO} ${ICONS}) set(RESOURCES ${LAUNCH_SCREEN} ${LOGO} ${ICONS}) set_target_properties(${target} PROPERTIES RESOURCE "${RESOURCES}" diff --git a/cmake/Modules/FindUDev.cmake b/cmake/Modules/FindUDev.cmake index 467bd6931..57f024609 100644 --- a/cmake/Modules/FindUDev.cmake +++ b/cmake/Modules/FindUDev.cmake @@ -9,7 +9,7 @@ # Redistribution and use of this file is allowed according to the terms of the BSD license. # -FIND_PATH( +find_path( UDEV_INCLUDE_DIR libudev.h /usr/include @@ -17,37 +17,37 @@ FIND_PATH( ${UDEV_PATH_INCLUDES} ) -FIND_LIBRARY( +find_library( UDEV_LIBRARIES NAMES udev libudev PATHS ${ADDITIONAL_LIBRARY_PATHS} ${UDEV_PATH_LIB} ) -IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR) - SET(UDEV_FOUND "YES") +if(UDEV_LIBRARIES AND UDEV_INCLUDE_DIR) + set(UDEV_FOUND "YES") execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE) # retvale is 0 of the condition is "true" so we need to negate the value... - if (UDEV_STABLE) + if(UDEV_STABLE) set(UDEV_STABLE 0) - else (UDEV_STABLE) + else() set(UDEV_STABLE 1) - endif (UDEV_STABLE) + endif() message(STATUS "libudev stable: ${UDEV_STABLE}") -ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR) +endif() -IF (UDEV_FOUND) - MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}") - MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}") -ELSE (UDEV_FOUND) - MESSAGE(STATUS "UDev not found.") - MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include") - MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}") - MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib") - MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}") - IF (UDev_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find UDev library") - ENDIF (UDev_FIND_REQUIRED) -ENDIF (UDEV_FOUND) +if(UDEV_FOUND) + message(STATUS "Found UDev: ${UDEV_LIBRARIES}") + message(STATUS " include: ${UDEV_INCLUDE_DIR}") +else() + message(STATUS "UDev not found.") + message(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include") + message(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}") + message(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib") + message(STATUS " currently found libs: ${UDEV_LIBRARIES}") + if(UDev_FIND_REQUIRED) + message(FATAL_ERROR "Could not find UDev library") + endif() +endif() mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIBRARIES) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b839284f9..a8610385c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,7 @@ target_compile_definitions(sfml-test-main PUBLIC DOCTEST_CONFIG_REQUIRE_STRINGIF target_link_libraries(sfml-test-main PUBLIC SFML::System doctest::doctest) set_target_warnings(sfml-test-main) -SET(SYSTEM_SRC +set(SYSTEM_SRC System/Angle.cpp System/Clock.cpp System/Config.cpp @@ -40,13 +40,13 @@ target_compile_definitions(test-sfml-system PRIVATE EXPECTED_SFML_VERSION_IS_RELEASE=$,true,false> ) -SET(WINDOW_SRC +set(WINDOW_SRC Window/ContextSettings.cpp Window/VideoMode.cpp ) sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window) -SET(GRAPHICS_SRC +set(GRAPHICS_SRC Graphics/BlendMode.cpp Graphics/CircleShape.cpp Graphics/Color.cpp @@ -65,13 +65,13 @@ SET(GRAPHICS_SRC ) sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics) -SET(NETWORK_SRC +set(NETWORK_SRC Network/IpAddress.cpp Network/Packet.cpp ) sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network) -SET(AUDIO_SRC +set(AUDIO_SRC Audio/Dummy.cpp # TODO: Remove when there are real tests ) sfml_add_test(test-sfml-audio "${AUDIO_SRC}" SFML::Audio)