From 622ae84876eaab27ab232ee72e97e090b0aa57c0 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 1 Jul 2016 18:50:36 +0200 Subject: [PATCH 1/1] Remove arguments of CMake's else() and endif() commands The need for them is long gone, but they are still permitted. Remove the remaining instances to make the code more consistent. --- CMakeLists.txt | 22 +++++++++++----------- cmake/FindExecInfo.cmake | 8 ++++---- cmake/FindPhonon.cmake | 4 ++-- cmake/FindQCA2-QT5.cmake | 6 +++--- cmake/FindQCA2.cmake | 6 +++--- pics/CMakeLists.txt | 14 +++++++------- po/CMakeLists.txt | 18 +++++++++--------- src/CMakeLists.txt | 16 ++++++++-------- src/common/CMakeLists.txt | 4 ++-- src/core/CMakeLists.txt | 2 +- src/qtui/CMakeLists.txt | 2 +- 11 files changed, 51 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d2fa8c5..e26e2b37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,17 +311,17 @@ if (USE_QT5) DESCRIPTION "KDE Frameworks" PURPOSE "Required for integration into the Plasma desktop" ) - else(WITH_KDE) + else() find_package(KF5Sonnet QUIET) set_package_properties(KF5Sonnet PROPERTIES TYPE RECOMMENDED URL "http://api.kde.org/frameworks-api/frameworks5-apidocs/sonnet/html" DESCRIPTION "framework for providing spell-checking capabilities" PURPOSE "Enables spell-checking support in input widgets" ) - endif(WITH_KDE) - endif(ECM_FOUND) + endif() + endif() - endif(BUILD_GUI) + endif() if (BUILD_CORE) find_package(Qt5Script QUIET) @@ -340,7 +340,7 @@ if (USE_QT5) PURPOSE "Required for encryption support" ) - endif(BUILD_CORE) + endif() find_package(Qt5LinguistTools QUIET) set_package_properties(Qt5LinguistTools PROPERTIES TYPE RECOMMENDED @@ -367,7 +367,7 @@ if (USE_QT5) endif() endif() -else(USE_QT5) +else() message(STATUS "Building for Qt4...") set(QT_MIN_VERSION "4.8.0") @@ -406,14 +406,14 @@ else(USE_QT5) ) set(CMAKE_C_FLAGS ${_cflags}) - else(WITH_KDE) + else() find_package(Phonon QUIET) set_package_properties(Phonon PROPERTIES TYPE RECOMMENDED URL "https://projects.kde.org/projects/kdesupport/phonon" DESCRIPTION "a multimedia abstraction library" PURPOSE "Required for audio notifications" ) - endif(WITH_KDE) + endif() find_package(IndicateQt QUIET) set_package_properties(IndicateQt PROPERTIES TYPE OPTIONAL @@ -422,7 +422,7 @@ else(USE_QT5) PURPOSE "Provides integration into the Ayatana notification system used by e.g. Ubuntu" ) - endif(BUILD_GUI) + endif() if (BUILD_CORE) @@ -574,7 +574,7 @@ if (NOT WIN32) check_function_exists(umask HAVE_UMASK) if(HAVE_UMASK) add_definitions(-DHAVE_UMASK) - endif(HAVE_UMASK) + endif() endif() @@ -635,7 +635,7 @@ endif() if (NOT GIT_HEAD OR NOT GIT_DESCRIBE) if (DEFINED ENV{GIT_HEAD}) set(GIT_HEAD $ENV{GIT_HEAD}) - endif () + endif() if (DEFINED ENV{GIT_DESCRIBE}) set(GIT_DESCRIBE $ENV{GIT_DESCRIBE}) endif() diff --git a/cmake/FindExecInfo.cmake b/cmake/FindExecInfo.cmake index 042a1151..94a5b881 100644 --- a/cmake/FindExecInfo.cmake +++ b/cmake/FindExecInfo.cmake @@ -9,7 +9,7 @@ find_path(EXECINFO_INCLUDES "execinfo.h") if(EXECINFO_INCLUDES STREQUAL "EXECINFO_INCLUDES-NOTFOUND") set(EXECINFO_INCLUDES "") -else(EXECINFO_INCLUDES STREQUAL "EXECINFO_INCLUDES-NOTFOUND") +else() # We found the header file's include dir. # Now determine if it's built-in or not, by searching the library file. @@ -19,11 +19,11 @@ else(EXECINFO_INCLUDES STREQUAL "EXECINFO_INCLUDES-NOTFOUND") # Built-in, no further action is needed set(EXECINFO_LIBRARIES "") message(STATUS "Found execinfo (built-in)") - else(EXECINFO_LIBRARIES STREQUAL "EXECINFO_LIBRARIES-NOTFOUND") + else() # It's an external library. message(STATUS "Found execinfo: ${EXECINFO_LIBRARIES}") - endif(EXECINFO_LIBRARIES STREQUAL "EXECINFO_LIBRARIES-NOTFOUND") + endif() set(EXECINFO_FOUND true) -endif(EXECINFO_INCLUDES STREQUAL "EXECINFO_INCLUDES-NOTFOUND") +endif() diff --git a/cmake/FindPhonon.cmake b/cmake/FindPhonon.cmake index cd9e5cb4..0254a02c 100644 --- a/cmake/FindPhonon.cmake +++ b/cmake/FindPhonon.cmake @@ -15,7 +15,7 @@ macro(_phonon_find_version) set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h") if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") - endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h") + endif() file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000) string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}") set(PHONON_VERSION "${CMAKE_MATCH_1}") @@ -29,7 +29,7 @@ if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}) _phonon_find_version() -endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) diff --git a/cmake/FindQCA2-QT5.cmake b/cmake/FindQCA2-QT5.cmake index e4a48887..6b1e0a99 100644 --- a/cmake/FindQCA2-QT5.cmake +++ b/cmake/FindQCA2-QT5.cmake @@ -34,14 +34,14 @@ if (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES) # in cache already set(QCA2-QT5_FOUND TRUE) -else (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES) +else() if (NOT WIN32) find_package(PkgConfig) pkg_check_modules(PC_QCA2-QT5 QUIET qca2-qt5) set(QCA2-QT5_DEFINITIONS ${PC_QCA2-QT5_CFLAGS_OTHER}) - endif (NOT WIN32) + endif() find_library_with_debug(QCA2-QT5_LIBRARIES WIN32_DEBUG_POSTFIX d @@ -57,5 +57,5 @@ else (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES) mark_as_advanced(QCA2-QT5_INCLUDE_DIR QCA2-QT5_LIBRARIES) -endif (QCA2-QT5_INCLUDE_DIR AND QCA2-QT5_LIBRARIES) +endif() endif() diff --git a/cmake/FindQCA2.cmake b/cmake/FindQCA2.cmake index e2d8f2a5..182a22f7 100644 --- a/cmake/FindQCA2.cmake +++ b/cmake/FindQCA2.cmake @@ -21,14 +21,14 @@ if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) # in cache already set(QCA2_FOUND TRUE) -else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) +else() if (NOT WIN32) find_package(PkgConfig) pkg_check_modules(PC_QCA2 QUIET qca2) set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER}) - endif (NOT WIN32) + endif() find_library_with_debug(QCA2_LIBRARIES WIN32_DEBUG_POSTFIX d @@ -45,4 +45,4 @@ else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) mark_as_advanced(QCA2_INCLUDE_DIR QCA2_LIBRARIES) -endif (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES) +endif() diff --git a/pics/CMakeLists.txt b/pics/CMakeLists.txt index 42da3884..d92e3a96 100644 --- a/pics/CMakeLists.txt +++ b/pics/CMakeLists.txt @@ -9,20 +9,20 @@ if(WIN32) "-o ${CMAKE_CURRENT_BINARY_DIR}/win32.o" "--include-dir=${CMAKE_CURRENT_SOURCE_DIR}") set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_BINARY_DIR}/win32.o PARENT_SCOPE) - endif(WINDRES_EXECUTABLE) - else(MINGW) + endif() + else() set(COMMON_DEPS ${COMMON_DEPS} ${CMAKE_CURRENT_SOURCE_DIR}/win32.rc PARENT_SCOPE) - endif(MINGW) -endif(WIN32) + endif() +endif() if(WANT_MONO OR WANT_QTCLIENT) if(EMBED_DATA) set(CLIENT_RCS ${CLIENT_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/pics.qrc PARENT_SCOPE) - else(EMBED_DATA) + else() # We don't find them yet externally, so disable installation set(CLIENT_RCS ${CLIENT_RCS} ${CMAKE_CURRENT_SOURCE_DIR}/pics.qrc PARENT_SCOPE) # install(FILES qt-logo.png # quassel-large.png # DESTINATION ${DATA_INSTALL_DIR}/quassel/pics) - endif(EMBED_DATA) -endif(WANT_MONO OR WANT_QTCLIENT) + endif() +endif() diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 1980a58c..03a6d055 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -17,21 +17,21 @@ if(QT_LCONVERT_EXECUTABLE) set(flg 1) if(LINGUAS) string(REGEX MATCH "${lang}" flg ${LINGUAS}) - endif(LINGUAS) + endif() if(flg) generate_ts(QM ${basename}) generate_qm(QM ${basename}) list(APPEND qm_files ${QM}) list(APPEND gen_linguas ${lang}) - endif(flg) + endif() endforeach(PO_FILE ${avail_pofiles}) if(gen_linguas) list(REMOVE_DUPLICATES gen_linguas) - endif(gen_linguas) + endif() message(STATUS "Including languages: ${gen_linguas}") -else(QT_LCONVERT_EXECUTABLE) +else() message(STATUS "WARNING: lconvert not found, you won't have translations!") -endif(QT_LCONVERT_EXECUTABLE) +endif() # For a static or win32 build, we need to include Qt translations if available if(QT_TRANSLATIONS_DIR) @@ -45,8 +45,8 @@ if(QT_TRANSLATIONS_DIR) list(APPEND qm_files ${CMAKE_CURRENT_BINARY_DIR}/${filename}) endforeach(absfile ${lang_files}) endforeach(LANG ${gen_linguas}) - endif(STATIC OR WIN32) -endif(QT_TRANSLATIONS_DIR) + endif() +endif() # Write resource file set(resfile ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc) @@ -63,8 +63,8 @@ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${qm_files};i18 if(EMBED_DATA) set(COMMON_RCS ${COMMON_RCS} ${resfile} PARENT_SCOPE) -else(EMBED_DATA) +else() install(FILES ${qm_files} DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/translations) -endif(EMBED_DATA) +endif() add_custom_target(po DEPENDS ${qm_files}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62219306..cff7f94c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,7 @@ include_directories(BEFORE common) if(BUILD_CORE) add_subdirectory(core) include_directories(BEFORE core) -endif(BUILD_CORE) +endif() if(BUILD_GUI) add_subdirectory(client) add_subdirectory(uisupport) @@ -17,8 +17,8 @@ if(BUILD_GUI) if(STATIC) link_directories(${QT_PLUGINS_DIR}/imageformats) set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} qjpeg qgif) - endif(STATIC) -endif(BUILD_GUI) + endif() +endif() include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) # for version.gen @@ -49,7 +49,7 @@ if(WANT_CORE) OUTPUT_NAME ../quasselcore) target_link_libraries(quasselcore mod_core mod_common ${COMMON_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY}) install(TARGETS quasselcore RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif(WANT_CORE) +endif() if (KDE4_FOUND) include_directories(${KDE4_INCLUDES}) @@ -64,7 +64,7 @@ if(WANT_QTCLIENT) OUTPUT_NAME ../quasselclient) target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY}) install(TARGETS quasselclient RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif(WANT_QTCLIENT) +endif() if(WANT_MONO) add_executable(quassel WIN32 common/main.cpp qtui/monoapplication.cpp ${CLIENT_DEPS} ${CORE_DEPS} ${COMMON_DEPS}) @@ -75,7 +75,7 @@ if(WANT_MONO) OUTPUT_NAME ../quassel) target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common ${COMMON_LIBRARIES} ${CLIENT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES} ${QT_QTMAIN_LIBRARY}) install(TARGETS quassel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif(WANT_MONO) +endif() # Build bundles for MacOSX if(APPLE) @@ -92,5 +92,5 @@ if(APPLE) COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core ..) add_custom_command(TARGET quasselcore POST_BUILD COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Mono ..) - endif(DEPLOY) -endif(APPLE) + endif() +endif() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 66416c37..56c562c6 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -74,7 +74,7 @@ endif() if (APPLE) set(SOURCES ${SOURCES} mac_utils.cpp) -endif(APPLE) +endif() if (WIN32) set(SOURCES ${SOURCES} logbacktrace_win.cpp) @@ -93,7 +93,7 @@ qt_use_modules(mod_common Core Network) if (APPLE) target_link_libraries(mod_common "-framework CoreServices" "-framework CoreFoundation") -endif(APPLE) +endif() target_link_libraries(mod_common ${CMAKE_DL_LIBS} ${EXECINFO_LIBRARIES}) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 43e68402..2332d8c4 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -45,7 +45,7 @@ set(LIBS ) if(HAVE_SSL) set(SOURCES ${SOURCES} sslserver.cpp) include_directories(${OPENSSL_INCLUDE_DIR}) -endif(HAVE_SSL) +endif() if (QCA2_FOUND) add_definitions(-DHAVE_QCA2) diff --git a/src/qtui/CMakeLists.txt b/src/qtui/CMakeLists.txt index 7e1574cf..5fee3df4 100644 --- a/src/qtui/CMakeLists.txt +++ b/src/qtui/CMakeLists.txt @@ -155,7 +155,7 @@ endif() if(HAVE_SSL) set(SOURCES ${SOURCES} sslinfodlg.cpp) set(FORMS ${FORMS} sslinfodlg.ui) -endif(HAVE_SSL) +endif() if (INDICATEQT_FOUND) add_definitions(-DHAVE_INDICATEQT) -- 2.20.1