From 0d0d0b6863510e7e3193207f8739c95e762b510a Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Wed, 28 Oct 2020 11:21:42 +0100 Subject: CMakeLists.txt: omit end{if,foreach} expressions Their usefulness was almost negative. --- CMakeLists.txt | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 015e044..4ee87ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC) # -Wunused-function is pretty annoying here, as everything is static set (wdisabled "-Wno-unused-function") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}") -endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC) +endif () # Version set (project_version "${PROJECT_VERSION}") @@ -28,8 +28,8 @@ if (GIT_FOUND AND EXISTS "${git_head}") set (git_ref "${PROJECT_SOURCE_DIR}/.git/${CMAKE_MATCH_1}") if (EXISTS "${git_ref}") configure_file ("${git_ref}" git-ref.tag COPYONLY) - endif (EXISTS "${git_ref}") - endif (git_head_content MATCHES "^ref: ([^\r\n]+)") + endif () + endif () execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --match v* WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} @@ -37,8 +37,8 @@ if (GIT_FOUND AND EXISTS "${git_head}") OUTPUT_VARIABLE git_describe OUTPUT_STRIP_TRAILING_WHITESPACE) if (NOT git_describe_result) string (REGEX REPLACE "^v" "" project_version "${git_describe}") - endif (NOT git_describe_result) -endif (GIT_FOUND AND EXISTS "${git_head}") + endif () +endif () # Dashes make filenames confusing and upset packaging software string (REPLACE "-" "+" project_version_safe "${project_version}") @@ -59,7 +59,7 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") # Need this for SIGWINCH in FreeBSD and OpenBSD respectively; # our POSIX version macros make it undefined add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1) -endif ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD") +endif () # -lrt is only for glibc < 2.17 # -liconv may or may not be a part of libc @@ -67,8 +67,8 @@ foreach (extra iconv rt) find_library (extra_lib_${extra} ${extra}) if (extra_lib_${extra}) list (APPEND project_libraries ${extra_lib_${extra}}) - endif (extra_lib_${extra}) -endforeach (extra) + endif () +endforeach () include (CheckCSourceRuns) set (CMAKE_REQUIRED_LIBRARIES ${project_libraries}) @@ -91,12 +91,12 @@ option (WITH_LUA "Enable support for Lua plugins" ${lua_FOUND}) if (WITH_LUA) if (NOT lua_FOUND) message (FATAL_ERROR "Lua library not found") - endif (NOT lua_FOUND) + endif () list (APPEND degesch_libraries ${lua_LIBRARIES}) include_directories (${lua_INCLUDE_DIRS}) link_directories (${lua_LIBRARY_DIRS}) -endif (WITH_LUA) +endif () find_package (Curses) pkg_check_modules (ncursesw ncursesw) @@ -106,9 +106,9 @@ if (ncursesw_FOUND) elseif (CURSES_FOUND) list (APPEND degesch_libraries ${CURSES_LIBRARY}) include_directories (${CURSES_INCLUDE_DIR}) -else (CURSES_FOUND) +else () message (SEND_ERROR "Curses not found") -endif (ncursesw_FOUND) +endif () if ((WANT_READLINE AND WANT_LIBEDIT) OR (NOT WANT_READLINE AND NOT WANT_LIBEDIT)) message (SEND_ERROR "You have to choose either GNU Readline or libedit") @@ -117,14 +117,14 @@ elseif (WANT_READLINE) if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD") include_directories (/usr/local/include/ereadline) list (APPEND degesch_libraries ereadline) - else ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD") + else () list (APPEND degesch_libraries readline) - endif ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD") + endif () elseif (WANT_LIBEDIT) pkg_check_modules (libedit REQUIRED libedit) list (APPEND degesch_libraries ${libedit_LIBRARIES}) include_directories (${libedit_INCLUDE_DIRS}) -endif ((WANT_READLINE AND WANT_LIBEDIT) OR (NOT WANT_READLINE AND NOT WANT_LIBEDIT)) +endif () # Generate a configuration file set (HAVE_READLINE "${WANT_READLINE}") @@ -150,7 +150,7 @@ foreach (name zyklonb degesch kike) add_executable (${name} ${name}.c ${PROJECT_BINARY_DIR}/config.h) target_link_libraries (${name} ${project_libraries}) add_threads (${name}) -endforeach (name) +endforeach () add_dependencies (kike replies) add_dependencies (degesch replies) @@ -168,7 +168,7 @@ if (BUILD_TESTING) add_test (NAME test-degesch COMMAND test-degesch) add_test (NAME custom-static-analysis COMMAND ${PROJECT_SOURCE_DIR}/test-static) -endif (BUILD_TESTING) +endif () # Various clang-based diagnostics, loads of fake positives and spam file (GLOB clang_tidy_sources *.c) @@ -196,7 +196,7 @@ install (DIRECTORY plugins/degesch/ find_program (HELP2MAN_EXECUTABLE help2man) if (NOT HELP2MAN_EXECUTABLE) message (FATAL_ERROR "help2man not found") -endif (NOT HELP2MAN_EXECUTABLE) +endif () foreach (page zyklonb degesch kike) set (page_output "${PROJECT_BINARY_DIR}/${page}.1") @@ -206,7 +206,7 @@ foreach (page zyklonb degesch kike) "${PROJECT_BINARY_DIR}/${page}" -o ${page_output} DEPENDS ${page} COMMENT "Generating man page for ${page}" VERBATIM) -endforeach (page) +endforeach () add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES}) @@ -214,7 +214,7 @@ foreach (page ${project_MAN_PAGES}) string (REGEX MATCH "\\.([0-9])$" manpage_suffix "${page}") install (FILES "${page}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man${CMAKE_MATCH_1}") -endforeach (page) +endforeach () # CPack set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Experimental IRC client, daemon and bot") -- cgit v1.2.3-70-g09d2