From 03f3ce7bdca95823c45e2d9991a8652e73e5a247 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Thu, 3 Jan 2019 09:25:58 -0500 Subject: [PATCH] Reformat CMake files. Applied `cmake_format`. --- cmake/Catch.cmake | 105 ++++++++++----------- cmake/CatchAddTests.cmake | 59 ++++++------ cmake/Conky.cmake | 142 ++++++++++++++++++---------- cmake/ConkyCPackSetup.cmake | 57 +++++------ cmake/ConkyPlatformChecks.cmake | 161 +++++++++++++++++++++----------- cmake/Docbook.cmake | 144 +++++++++++++++------------- cmake/FindClangTidy.cmake | 28 +++--- cmake/FindXinerama.cmake | 42 ++++----- cmake/ToLua.cmake | 84 +++++++++-------- cmake/clang-tidy.cmake | 19 ++-- data/CMakeLists.txt | 60 ++++++------ doc/CMakeLists.txt | 25 +++-- lua/CMakeLists.txt | 116 ++++++++++++----------- 13 files changed, 570 insertions(+), 472 deletions(-) diff --git a/cmake/Catch.cmake b/cmake/Catch.cmake index 486e3233..09e0bf05 100644 --- a/cmake/Catch.cmake +++ b/cmake/Catch.cmake @@ -92,15 +92,13 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``. #]=======================================================================] -#------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ function(catch_discover_tests TARGET) - cmake_parse_arguments( - "" - "" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST" - "TEST_SPEC;EXTRA_ARGS;PROPERTIES" - ${ARGN} - ) + cmake_parse_arguments("" + "" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST" + "TEST_SPEC;EXTRA_ARGS;PROPERTIES" + ${ARGN}) if(NOT _WORKING_DIRECTORY) set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") @@ -109,67 +107,66 @@ function(catch_discover_tests TARGET) set(_TEST_LIST ${TARGET}_TESTS) endif() - ## Generate a unique name based on the extra arguments + # Generate a unique name based on the extra arguments string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}") - string(SUBSTRING ${args_hash} 0 7 args_hash) + string(SUBSTRING ${args_hash} + 0 + 7 + args_hash) # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake") + set(ctest_include_file + "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake") + set(ctest_tests_file + "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake") get_property(crosscompiling_emulator - TARGET ${TARGET} - PROPERTY CROSSCOMPILING_EMULATOR - ) - add_custom_command( - TARGET ${TARGET} POST_BUILD - BYPRODUCTS "${ctest_tests_file}" - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TARGET=${TARGET}" - -D "TEST_EXECUTABLE=$" - -D "TEST_EXECUTOR=${crosscompiling_emulator}" - -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" - -D "TEST_SPEC=${_TEST_SPEC}" - -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" - -D "TEST_PROPERTIES=${_PROPERTIES}" - -D "TEST_PREFIX=${_TEST_PREFIX}" - -D "TEST_SUFFIX=${_TEST_SUFFIX}" - -D "TEST_LIST=${_TEST_LIST}" - -D "CTEST_FILE=${ctest_tests_file}" - -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" - VERBATIM - ) + TARGET ${TARGET} + PROPERTY CROSSCOMPILING_EMULATOR) + add_custom_command(TARGET + ${TARGET} + POST_BUILD + BYPRODUCTS + "${ctest_tests_file}" + COMMAND "${CMAKE_COMMAND}" -D "TEST_TARGET=${TARGET}" -D + "TEST_EXECUTABLE=$" -D + "TEST_EXECUTOR=${crosscompiling_emulator}" -D + "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" -D + "TEST_SPEC=${_TEST_SPEC}" -D + "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" -D + "TEST_PROPERTIES=${_PROPERTIES}" -D + "TEST_PREFIX=${_TEST_PREFIX}" -D + "TEST_SUFFIX=${_TEST_SUFFIX}" -D + "TEST_LIST=${_TEST_LIST}" -D + "CTEST_FILE=${ctest_tests_file}" -P + "${_CATCH_DISCOVER_TESTS_SCRIPT}" + VERBATIM) - file(WRITE "${ctest_include_file}" - "if(EXISTS \"${ctest_tests_file}\")\n" - " include(\"${ctest_tests_file}\")\n" - "else()\n" - " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n" - "endif()\n" - ) + file( + WRITE + "${ctest_include_file}" + "if(EXISTS \"${ctest_tests_file}\")\n" + " include(\"${ctest_tests_file}\")\n" + "else()\n" + " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n" + "endif()\n") - if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") + if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") # Add discovered tests to directory TEST_INCLUDE_FILES set_property(DIRECTORY - APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}" - ) + APPEND + PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}") else() # Add discovered tests as directory TEST_INCLUDE_FILE if possible get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET) - if (NOT ${test_include_file_set}) - set_property(DIRECTORY - PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}" - ) + if(NOT ${test_include_file_set}) + set_property(DIRECTORY PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}") else() - message(FATAL_ERROR - "Cannot set more than one TEST_INCLUDE_FILE" - ) + message(FATAL_ERROR "Cannot set more than one TEST_INCLUDE_FILE") endif() endif() endfunction() -############################################################################### +# -set(_CATCH_DISCOVER_TESTS_SCRIPT - ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake -) +set(_CATCH_DISCOVER_TESTS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake) diff --git a/cmake/CatchAddTests.cmake b/cmake/CatchAddTests.cmake index 2220ce3a..50f69b9a 100644 --- a/cmake/CatchAddTests.cmake +++ b/cmake/CatchAddTests.cmake @@ -24,49 +24,48 @@ endfunction() # Run test executable to get list of available tests if(NOT EXISTS "${TEST_EXECUTABLE}") - message(FATAL_ERROR - "Specified test executable '${TEST_EXECUTABLE}' does not exist" - ) + message( + FATAL_ERROR "Specified test executable '${TEST_EXECUTABLE}' does not exist") endif() -execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only - OUTPUT_VARIABLE output - RESULT_VARIABLE result -) -# Catch --list-test-names-only reports the number of tests, so 0 is... surprising +execute_process(COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} + --list-test-names-only + OUTPUT_VARIABLE output + RESULT_VARIABLE result) +# Catch --list-test-names-only reports the number of tests, so 0 is... +# surprising if(${result} EQUAL 0) - message(WARNING - "Test executable '${TEST_EXECUTABLE}' contains no tests!\n" - ) + message(WARNING "Test executable '${TEST_EXECUTABLE}' contains no tests!\n") elseif(${result} LESS 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${result}\n" - " Output: ${output}\n" - ) + message(FATAL_ERROR "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${result}\n" " Output: ${output}\n") endif() -string(REPLACE "\n" ";" output "${output}") +string(REPLACE "\n" + ";" + output + "${output}") # Parse output foreach(line ${output}) set(test ${line}) # use escape commas to handle properly test cases with commans inside the name - string(REPLACE "," "\\," test_name ${test}) + string(REPLACE "," + "\\," + test_name + ${test}) # ...and add to script add_command(add_test - "${prefix}${test}${suffix}" - ${TEST_EXECUTOR} - "${TEST_EXECUTABLE}" - "${test_name}" - ${extra_args} - ) + "${prefix}${test}${suffix}" + ${TEST_EXECUTOR} + "${TEST_EXECUTABLE}" + "${test_name}" + ${extra_args}) add_command(set_tests_properties - "${prefix}${test}${suffix}" - PROPERTIES - WORKING_DIRECTORY "${TEST_WORKING_DIR}" - ${properties} - ) + "${prefix}${test}${suffix}" + PROPERTIES + WORKING_DIRECTORY + "${TEST_WORKING_DIR}" + ${properties}) list(APPEND tests "${prefix}${test}${suffix}") endforeach() diff --git a/cmake/Conky.cmake b/cmake/Conky.cmake index e0a932f6..19dd4e46 100644 --- a/cmake/Conky.cmake +++ b/cmake/Conky.cmake @@ -3,23 +3,22 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # -#set(RELEASE true) +# set(RELEASE true) # Set system vars if(CMAKE_SYSTEM_NAME MATCHES "Linux") @@ -54,11 +53,37 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(OS_DARWIN true) endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") -if(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY - AND NOT OS_SOLARIS AND NOT OS_HAIKU AND NOT OS_DARWIN) - message(FATAL_ERROR "Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome.") -endif(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY - AND NOT OS_SOLARIS AND NOT OS_HAIKU AND NOT OS_DARWIN) +if(NOT OS_LINUX + AND NOT OS_FREEBSD + AND NOT OS_OPENBSD + AND NOT OS_DRAGONFLY + AND NOT OS_SOLARIS + AND NOT OS_HAIKU + AND NOT OS_DARWIN) + message( + FATAL_ERROR + "Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome." + ) +endif(NOT + OS_LINUX + AND + NOT + OS_FREEBSD + AND + NOT + OS_OPENBSD + AND + NOT + OS_DRAGONFLY + AND + NOT + OS_SOLARIS + AND + NOT + OS_HAIKU + AND + NOT + OS_DARWIN) include(FindThreads) find_package(Threads) @@ -67,13 +92,17 @@ set(conky_libs ${CMAKE_THREAD_LIBS_INIT}) set(conky_includes ${CMAKE_BINARY_DIR}) # -# On Darwin _POSIX_C_SOURCE must be >= __DARWIN_C_FULL for asprintf to be enabled! -# Thus disable this and _LARGEFILE64_SOURCE isnt needed, it is already used on macOS. +# On Darwin _POSIX_C_SOURCE must be >= __DARWIN_C_FULL for asprintf to be +# enabled! Thus disable this and _LARGEFILE64_SOURCE isnt needed, it is already +# used on macOS. # if(NOT OS_DARWIN) - add_definitions(-D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L) # Standard definitions - set(CMAKE_REQUIRED_DEFINITIONS - "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L") + add_definitions(-D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L) # Standard + # definitions + set( + CMAKE_REQUIRED_DEFINITIONS + "${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L" + ) endif(NOT OS_DARWIN) if(OS_DRAGONFLY) @@ -120,17 +149,22 @@ endif(NOT RELEASE) mark_as_advanced(APP_AWK APP_WC APP_DATE APP_UNAME) -#BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date) -#BUILD_ARCH="$(uname -sr) ($(uname -m))" -execute_process(COMMAND ${APP_DATE} RESULT_VARIABLE RETVAL OUTPUT_VARIABLE - BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND ${APP_UNAME} -srm RESULT_VARIABLE RETVAL - OUTPUT_VARIABLE BUILD_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) +# BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date) BUILD_ARCH="$(uname +# -sr) ($(uname -m))" +execute_process(COMMAND ${APP_DATE} + RESULT_VARIABLE RETVAL + OUTPUT_VARIABLE BUILD_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND ${APP_UNAME} -srm + RESULT_VARIABLE RETVAL + OUTPUT_VARIABLE BUILD_ARCH + OUTPUT_STRIP_TRAILING_WHITESPACE) if(RELEASE) set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") else(RELEASE) - set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_pre${COMMIT_COUNT}") + set(VERSION + "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}_pre${COMMIT_COUNT}") endif(RELEASE) set(COPYRIGHT "Copyright Brenden Matthews, et al, 2005-2018") @@ -146,11 +180,13 @@ macro(AC_SEARCH_LIBS FUNCTION_NAME INCLUDES TARGET_VAR) unset(AC_SEARCH_LIBS_TMP CACHE) unset(AC_SEARCH_LIBS_FOUND CACHE) find_library(AC_SEARCH_LIBS_TMP ${LIB}) - check_library_exists(${LIB} ${FUNCTION_NAME} ${AC_SEARCH_LIBS_TMP} - AC_SEARCH_LIBS_FOUND) + check_library_exists(${LIB} + ${FUNCTION_NAME} + ${AC_SEARCH_LIBS_TMP} + AC_SEARCH_LIBS_FOUND) if(${AC_SEARCH_LIBS_FOUND}) - set(${TARGET_VAR} ${AC_SEARCH_LIBS_TMP} CACHE INTERNAL - "Library containing ${FUNCTION_NAME}") + set(${TARGET_VAR} ${AC_SEARCH_LIBS_TMP} + CACHE INTERNAL "Library containing ${FUNCTION_NAME}") break() endif(${AC_SEARCH_LIBS_FOUND}) endforeach(LIB) @@ -158,26 +194,30 @@ macro(AC_SEARCH_LIBS FUNCTION_NAME INCLUDES TARGET_VAR) endif("${TARGET_VAR}" MATCHES "^${TARGET_VAR}$") endmacro(AC_SEARCH_LIBS) - # A function to print the target build properties function(print_target_properties tgt) - if(NOT TARGET ${tgt}) - message("There is no target named '${tgt}'") - return() + if(NOT TARGET ${tgt}) + message("There is no target named '${tgt}'") + return() + endif() + + # this list of properties can be extended as needed + set(CMAKE_PROPERTY_LIST + SOURCE_DIR + BINARY_DIR + COMPILE_DEFINITIONS + COMPILE_OPTIONS + INCLUDE_DIRECTORIES + LINK_LIBRARIES) + + message("Configuration for target ${tgt}") + + foreach(prop ${CMAKE_PROPERTY_LIST}) + get_property(propval TARGET ${tgt} PROPERTY ${prop} SET) + if(propval) + get_target_property(propval ${tgt} ${prop}) + message(STATUS "${prop} = ${propval}") endif() - - # this list of properties can be extended as needed - set(CMAKE_PROPERTY_LIST SOURCE_DIR BINARY_DIR COMPILE_DEFINITIONS - COMPILE_OPTIONS INCLUDE_DIRECTORIES LINK_LIBRARIES) - - message("Configuration for target ${tgt}") - - foreach (prop ${CMAKE_PROPERTY_LIST}) - get_property(propval TARGET ${tgt} PROPERTY ${prop} SET) - if (propval) - get_target_property(propval ${tgt} ${prop}) - message (STATUS "${prop} = ${propval}") - endif() - endforeach(prop) + endforeach(prop) endfunction(print_target_properties) diff --git a/cmake/ConkyCPackSetup.cmake b/cmake/ConkyCPackSetup.cmake index 60f0e9b3..a4d53c1c 100644 --- a/cmake/ConkyCPackSetup.cmake +++ b/cmake/ConkyCPackSetup.cmake @@ -3,19 +3,18 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # @@ -23,40 +22,42 @@ set(CPACK_GENERATOR "TGZ;STGZ;DEB") set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)") set(CPACK_PACKAGE_CONTACT "brenden@diddyinc.com") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Brenden Matthews") -set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}-${CMAKE_SYSTEM_NAME}-${CPU_ARCH}") +set(CPACK_PACKAGE_FILE_NAME + "${PROJECT_NAME}-${VERSION}-${CMAKE_SYSTEM_NAME}-${CPU_ARCH}") set(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME}) set(CPACK_STRIP_FILES true) -# Version numbering, copyright notice, etc. are taken from the variables -# defined in ../CMakeLists.txt. +# Version numbering, copyright notice, etc. are taken from the variables defined +# in ../CMakeLists.txt. set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") if(CPACK_GENERATOR MATCHES "NSIS") - set(CPACK_NSIS_COMPRESSOR "/FINAL /SOLID lzma") - set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} ${PROJECT_NAME}) + set(CPACK_NSIS_COMPRESSOR "/FINAL /SOLID lzma") + set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} ${PROJECT_NAME}) endif(CPACK_GENERATOR MATCHES "NSIS") # Source package setup. Compile with "make package_source". set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}-src") set(CPACK_SOURCE_GENERATOR "TBZ2") -execute_process(COMMAND ${APP_UNAME} COMMAND ${APP_AWK} "{print $1}" - RESULT_VARIABLE RETVAL OUTPUT_VARIABLE CPU_ARCH - OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND ${APP_UNAME} + COMMAND ${APP_AWK} "{print $1}" + RESULT_VARIABLE RETVAL + OUTPUT_VARIABLE CPU_ARCH + OUTPUT_STRIP_TRAILING_WHITESPACE) set(CPACK_SOURCE_IGNORE_FILES - # Exclude backup files generated by text editors. - "~$" - # Git dir/files. - "\\\\.git.*$" - # vim swap files - "\\\\..*\\\\.swp$" - # Build dir. - "build.*$" - ) + # Exclude backup files generated by text editors. + "~$" + # Git dir/files. + "\\\\.git.*$" + # vim swap files + "\\\\..*\\\\.swp$" + # Build dir. + "build.*$") # Enable CPack include(CPack) diff --git a/cmake/ConkyPlatformChecks.cmake b/cmake/ConkyPlatformChecks.cmake index 801d9243..0aad689c 100644 --- a/cmake/ConkyPlatformChecks.cmake +++ b/cmake/ConkyPlatformChecks.cmake @@ -3,19 +3,18 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # @@ -42,7 +41,7 @@ else(CMAKE_SYSTEM_NAME MATCHES "Darwin") check_symbol_exists(statfs64 "sys/statfs.h" HAVE_STATFS64) endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") -AC_SEARCH_LIBS(clock_gettime "time.h" CLOCK_GETTIME_LIB "rt") +ac_search_libs(clock_gettime "time.h" CLOCK_GETTIME_LIB "rt") if(NOT DEFINED CLOCK_GETTIME_LIB) if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") message(FATAL_ERROR "clock_gettime not found.") @@ -92,11 +91,37 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(OS_DARWIN true) endif(CMAKE_SYSTEM_NAME MATCHES "Darwin") -if(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY - AND NOT OS_SOLARIS AND NOT OS_HAIKU AND NOT OS_DARWIN) - message(FATAL_ERROR "Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome.") -endif(NOT OS_LINUX AND NOT OS_FREEBSD AND NOT OS_OPENBSD AND NOT OS_DRAGONFLY - AND NOT OS_SOLARIS AND NOT OS_HAIKU AND NOT OS_DARWIN) +if(NOT OS_LINUX + AND NOT OS_FREEBSD + AND NOT OS_OPENBSD + AND NOT OS_DRAGONFLY + AND NOT OS_SOLARIS + AND NOT OS_HAIKU + AND NOT OS_DARWIN) + message( + FATAL_ERROR + "Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome." + ) +endif(NOT + OS_LINUX + AND + NOT + OS_FREEBSD + AND + NOT + OS_OPENBSD + AND + NOT + OS_DRAGONFLY + AND + NOT + OS_SOLARIS + AND + NOT + OS_HAIKU + AND + NOT + OS_DARWIN) # Check for soundcard header if(OS_LINUX) @@ -113,23 +138,22 @@ if(BUILD_I18N AND OS_DRAGONFLY) endif(BUILD_I18N AND OS_DRAGONFLY) if(BUILD_I18N AND OS_DARWIN) - find_path(LIBINTL_H_N libintl.h PATHS - /usr/local/opt/gettext/include - /usr/include - /usr/local/include - /usr/local/opt/include - ) + find_path(LIBINTL_H_N libintl.h + PATHS /usr/local/opt/gettext/include + /usr/include + /usr/local/include + /usr/local/opt/include) if(LIBINTL_H_N) include_directories(${LIBINTL_H_N}) else(LIBINTL_H_N) message(FATAL_ERROR "Unable to find libintl.h (try `brew install gettext`)") endif(LIBINTL_H_N) - find_library(INTL_LIB NAMES intl PATHS - /usr/local/opt/gettext/lib - /usr/lib - /usr/local/lib - /usr/local/opt/lib - ) + find_library(INTL_LIB + NAMES intl + PATHS /usr/local/opt/gettext/lib + /usr/lib + /usr/local/lib + /usr/local/opt/lib) set(conky_libs ${conky_libs} ${INTL_LIB}) endif(BUILD_I18N AND OS_DARWIN) @@ -198,7 +222,11 @@ if(BUILD_NCURSES) endif(BUILD_NCURSES) if(BUILD_MYSQL) - find_path(mysql_INCLUDE_PATH mysql.h ${INCLUDE_SEARCH_PATH} /usr/include/mysql /usr/local/include/mysql) + find_path(mysql_INCLUDE_PATH + mysql.h + ${INCLUDE_SEARCH_PATH} + /usr/include/mysql + /usr/local/include/mysql) if(NOT mysql_INCLUDE_PATH) message(FATAL_ERROR "Unable to find mysql.h") endif(NOT mysql_INCLUDE_PATH) @@ -229,20 +257,24 @@ if(BUILD_PORT_MONITORS) if(NOT HAVE_GETNAMEINFO) message(FATAL_ERROR "could not find getnameinfo()") endif(NOT HAVE_GETNAMEINFO) - check_include_files("netdb.h;netinet/in.h;netinet/tcp.h;sys/socket.h;arpa/inet.h" HAVE_PORTMON_HEADERS) + check_include_files( + "netdb.h;netinet/in.h;netinet/tcp.h;sys/socket.h;arpa/inet.h" + HAVE_PORTMON_HEADERS) if(NOT HAVE_PORTMON_HEADERS) message(FATAL_ERROR "missing needed network header(s) for port monitoring") endif(NOT HAVE_PORTMON_HEADERS) endif(BUILD_PORT_MONITORS) - # Check for iconv if(BUILD_ICONV) check_include_files(iconv.h HAVE_ICONV_H) find_library(ICONV_LIBRARY NAMES iconv) if(NOT ICONV_LIBRARY) # maybe iconv() is provided by libc - set(ICONV_LIBRARY "" CACHE FILEPATH "Path to the iconv library, if iconv is not provided by libc" FORCE) + set(ICONV_LIBRARY "" + CACHE FILEPATH + "Path to the iconv library, if iconv is not provided by libc" + FORCE) endif(NOT ICONV_LIBRARY) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY}) check_function_exists(iconv ICONV_FUNC) @@ -254,7 +286,6 @@ if(BUILD_ICONV) endif(HAVE_ICONV_H AND ICONV_FUNC) endif(BUILD_ICONV) - # check for Xlib if(BUILD_X11) include(FindX11) @@ -278,23 +309,27 @@ if(BUILD_X11) if(NOT X11_Xshape_FOUND) message(FATAL_ERROR "Unable to find Xshape library") endif(NOT X11_Xshape_FOUND) - set(conky_libs ${conky_libs} ${X11_Xshape_LIB} ) + set(conky_libs ${conky_libs} ${X11_Xshape_LIB}) endif(BUILD_XSHAPE) # check for Xft if(BUILD_XFT) - find_path(freetype_INCLUDE_PATH config/ftconfig.h ${INCLUDE_SEARCH_PATH} - /usr/include/freetype2 - /usr/local/include/freetype2 - /usr/pkg/include/freetype2) + find_path(freetype_INCLUDE_PATH + config/ftconfig.h + ${INCLUDE_SEARCH_PATH} + /usr/include/freetype2 + /usr/local/include/freetype2 + /usr/pkg/include/freetype2) if(freetype_INCLUDE_PATH) set(freetype_FOUND true) set(conky_includes ${conky_includes} ${freetype_INCLUDE_PATH}) else(freetype_INCLUDE_PATH) - find_path(freetype_INCLUDE_PATH freetype/config/ftconfig.h ${INCLUDE_SEARCH_PATH} - /usr/include/freetype2 - /usr/local/include/freetype2 - /usr/pkg/include/freetype2) + find_path(freetype_INCLUDE_PATH + freetype/config/ftconfig.h + ${INCLUDE_SEARCH_PATH} + /usr/include/freetype2 + /usr/local/include/freetype2 + /usr/pkg/include/freetype2) if(freetype_INCLUDE_PATH) set(freetype_FOUND true) set(conky_includes ${conky_includes} ${freetype_INCLUDE_PATH}) @@ -321,7 +356,15 @@ if(BUILD_X11) endif(BUILD_X11) # Otherwise, use the most recent Lua version -pkg_search_module(LUA REQUIRED lua>=5.3 lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52) +pkg_search_module(LUA + REQUIRED + lua>=5.3 + lua5.3 + lua-5.3 + lua53 + lua5.2 + lua-5.2 + lua52) set(conky_libs ${conky_libs} ${LUA_LIBRARIES}) set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS}) link_directories(${LUA_LIBRARY_DIRS}) @@ -341,7 +384,10 @@ if(BUILD_X11) if(BUILD_LUA_IMLIB2) pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2) set(luaimlib2_libs ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS} ${LUA_LIBRARIES}) - set(luaimlib2_includes ${IMLIB2_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS} ${X11_INCLUDE_DIR}) + set(luaimlib2_includes + ${IMLIB2_INCLUDE_DIRS} + ${LUA_INCLUDE_DIRS} + ${X11_INCLUDE_DIR}) endif(BUILD_LUA_IMLIB2) if(BUILD_LUA_RSVG) pkg_check_modules(RSVG REQUIRED librsvg-2.0) @@ -360,7 +406,10 @@ if(BUILD_AUDACIOUS) pkg_check_modules(AUDACIOUS REQUIRED audacious<1.4.0) endif(NEW_AUDACIOUS_FOUND) set(conky_libs ${conky_libs} ${AUDACIOUS_LIBRARIES} ${DBUS_GLIB_LIBRARIES}) - set(conky_includes ${conky_includes} ${AUDACIOUS_INCLUDE_DIRS} ${DBUS_GLIB_INCLUDE_DIRS}) + set(conky_includes + ${conky_includes} + ${AUDACIOUS_INCLUDE_DIRS} + ${DBUS_GLIB_INCLUDE_DIRS}) endif(BUILD_AUDACIOUS) if(BUILD_BMPX) @@ -473,7 +522,12 @@ if(MAINTAINER_MODE) if(NOT APP_SED) message(FATAL_ERROR "Unable to find program 'sed'") endif(NOT APP_SED) - mark_as_advanced(APP_DB2X_XSLTPROC APP_DB2X_MANXML APP_XSLTPROC APP_MAN APP_SED APP_LESS) + mark_as_advanced(APP_DB2X_XSLTPROC + APP_DB2X_MANXML + APP_XSLTPROC + APP_MAN + APP_SED + APP_LESS) endif(MAINTAINER_MODE) if(CMAKE_BUILD_TYPE MATCHES "Debug") @@ -483,9 +537,12 @@ endif(CMAKE_BUILD_TYPE MATCHES "Debug") # The version numbers are simply derived from the date and number of commits # since start of month if(DEBUG) - execute_process(COMMAND - ${APP_GIT} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git log - --since=${VERSION_MAJOR}-${VERSION_MINOR}-01 --pretty=oneline COMMAND - ${APP_WC} -l COMMAND ${APP_AWK} "{print $1}" RESULT_VARIABLE RETVAL - OUTPUT_VARIABLE COMMIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${APP_GIT} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git + log --since=${VERSION_MAJOR}-${VERSION_MINOR}-01 + --pretty=oneline + COMMAND ${APP_WC} -l + COMMAND ${APP_AWK} "{print $1}" + RESULT_VARIABLE RETVAL + OUTPUT_VARIABLE COMMIT_COUNT + OUTPUT_STRIP_TRAILING_WHITESPACE) endif(DEBUG) diff --git a/cmake/Docbook.cmake b/cmake/Docbook.cmake index cc8af500..5352107d 100644 --- a/cmake/Docbook.cmake +++ b/cmake/Docbook.cmake @@ -3,87 +3,97 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ${db2x_xsltproc_cmd} -s man ${srcdir}/docs.xml -o docs.mxml -# ${db2x_manxml_cmd} docs.mxml -# ${xsltproc_cmd} ${srcdir}/docbook-xml/docbook.xsl ${srcdir}/docs.xml > docs.html -# man -P 'less -is' ./conky.1 > README -# sed -i "s/[[:cntrl:]]\[[0-9]*m//g" README -# sed -i "s/\xE2//g" README -# sed -i "s/\x80//g" README -# sed -i "s/\x90/-/g" README -# mv README ${top_srcdir} -# ${xsltproc_cmd} ${srcdir}/variables.xsl ${srcdir}/variables.xml > variables.html -# ${xsltproc_cmd} ${srcdir}/config_settings.xsl ${srcdir}/config_settings.xml > config_settings.html -# ${xsltproc_cmd} ${srcdir}/lua.xsl ${srcdir}/lua.xml > lua.html +# ${db2x_xsltproc_cmd} -s man ${srcdir}/docs.xml -o docs.mxml ${db2x_manxml_cmd} +# docs.mxml ${xsltproc_cmd} ${srcdir}/docbook-xml/docbook.xsl ${srcdir}/docs.xml +# > docs.html man -P 'less -is' ./conky.1 > README sed -i +# "s/[[:cntrl:]]\[[0-9]*m//g" README sed -i "s/\xE2//g" README sed -i +# "s/\x80//g" README sed -i "s/\x90/-/g" README mv README ${top_srcdir} +# ${xsltproc_cmd} ${srcdir}/variables.xsl ${srcdir}/variables.xml > +# variables.html ${xsltproc_cmd} ${srcdir}/config_settings.xsl +# ${srcdir}/config_settings.xml > config_settings.html ${xsltproc_cmd} +# ${srcdir}/lua.xsl ${srcdir}/lua.xml > lua.html -#else -#conky.1: +# else conky.1: -#endif +# endif -#man_MANS = conky.1 +# man_MANS = conky.1 if(MAINTAINER_MODE) - function(wrap_xsltproc) - if(NOT ARGV) - message(SEND_ERROR "Error: wrap_xsltproc called without any files") - return() - endif(NOT ARGV) + function(wrap_xsltproc) + if(NOT ARGV) + message(SEND_ERROR "Error: wrap_xsltproc called without any files") + return() + endif(NOT ARGV) - FOREACH(FIL ${ARGV}) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html - COMMAND ${APP_XSLTPROC} ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xsl ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xsl ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml - COMMENT "Running xsltproc on ${FIL}" - ) - ADD_CUSTOM_TARGET(${FIL}.html ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html) - ENDFOREACH(FIL) + foreach(FIL ${ARGV}) + add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html + COMMAND ${APP_XSLTPROC} + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xsl + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xsl + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml + COMMENT "Running xsltproc on ${FIL}") + add_custom_target(${FIL}.html ALL + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html) + endforeach(FIL) - endfunction(wrap_xsltproc) + endfunction(wrap_xsltproc) + function(wrap_man) + if(NOT ARGV) + message(SEND_ERROR "Error: wrap_man called without any files") + return() + endif(NOT ARGV) - function(wrap_man) - if(NOT ARGV) - message(SEND_ERROR "Error: wrap_man called without any files") - return() - endif(NOT ARGV) + foreach(FIL ${ARGV}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.1 + ${CMAKE_SOURCE_DIR}/README + COMMAND ${APP_XSLTPROC} + ${CMAKE_SOURCE_DIR}/doc/docbook-xml/html/docbook.xsl + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html + COMMAND ${APP_DB2X_XSLTPROC} -s man + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml -o ${FIL}.mxml + COMMAND ${APP_DB2X_MANXML} + --encoding=utf-8 ${FIL}.mxml + --output-dir ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${APP_XSLTPROC} + ${CMAKE_SOURCE_DIR}/doc/docbook-xml/html/docbook.xsl + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > + ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html + COMMAND ${APP_MAN} -P '${APP_LESS} -is' + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.1 > + ${CMAKE_SOURCE_DIR}/README + COMMAND ${APP_SED} -i'' -e 's/[[:cntrl:]]\\[[0-9]*m//g' + ${CMAKE_SOURCE_DIR}/README + COMMAND ${APP_SED} -i'' -e 's/\\xE2//g' ${CMAKE_SOURCE_DIR}/README + COMMAND ${APP_SED} -i'' -e 's/\\x80//g' ${CMAKE_SOURCE_DIR}/README + COMMAND ${APP_SED} -i'' -e 's/\\x90/-/g' ${CMAKE_SOURCE_DIR}/README + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml + COMMENT "Proccessing man page for ${FIL}") + add_custom_target(${FIL} ALL + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html) + endforeach(FIL) - FOREACH(FIL ${ARGV}) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.1 ${CMAKE_SOURCE_DIR}/README - COMMAND ${APP_XSLTPROC} ${CMAKE_SOURCE_DIR}/doc/docbook-xml/html/docbook.xsl ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html - - COMMAND ${APP_DB2X_XSLTPROC} -s man ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml -o ${FIL}.mxml - COMMAND ${APP_DB2X_MANXML} --encoding=utf-8 ${FIL}.mxml --output-dir ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${APP_XSLTPROC} ${CMAKE_SOURCE_DIR}/doc/docbook-xml/html/docbook.xsl ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml > ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html - COMMAND ${APP_MAN} -P '${APP_LESS} -is' ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.1 > ${CMAKE_SOURCE_DIR}/README - COMMAND ${APP_SED} -i'' -e 's/[[:cntrl:]]\\[[0-9]*m//g' ${CMAKE_SOURCE_DIR}/README - COMMAND ${APP_SED} -i'' -e 's/\\xE2//g' ${CMAKE_SOURCE_DIR}/README - COMMAND ${APP_SED} -i'' -e 's/\\x80//g' ${CMAKE_SOURCE_DIR}/README - COMMAND ${APP_SED} -i'' -e 's/\\x90/-/g' ${CMAKE_SOURCE_DIR}/README - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.xml - COMMENT "Proccessing man page for ${FIL}" - ) - ADD_CUSTOM_TARGET(${FIL} ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FIL}.html) - ENDFOREACH(FIL) - - endfunction(wrap_man) + endfunction(wrap_man) endif(MAINTAINER_MODE) diff --git a/cmake/FindClangTidy.cmake b/cmake/FindClangTidy.cmake index 473c9fb6..0e9adffb 100644 --- a/cmake/FindClangTidy.cmake +++ b/cmake/FindClangTidy.cmake @@ -2,34 +2,28 @@ # if(NOT CLANG_TIDY_BIN_NAME) - set(CLANG_TIDY_BIN_NAME clang-tidy) + set(CLANG_TIDY_BIN_NAME clang-tidy) endif() # if custom path check there first if(CLANG_TIDY_ROOT_DIR) - find_program(CLANG_TIDY_BIN - NAMES - ${CLANG_TIDY_BIN_NAME} - PATHS - "${CLANG_TIDY_ROOT_DIR}" - NO_DEFAULT_PATH) + find_program(CLANG_TIDY_BIN + NAMES ${CLANG_TIDY_BIN_NAME} + PATHS "${CLANG_TIDY_ROOT_DIR}" + NO_DEFAULT_PATH) endif() find_program(CLANG_TIDY_BIN NAMES ${CLANG_TIDY_BIN_NAME}) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS( - CLANG_TIDY - DEFAULT_MSG -CLANG_TIDY_BIN) +find_package_handle_standard_args(CLANG_TIDY DEFAULT_MSG CLANG_TIDY_BIN) -mark_as_advanced( - CLANG_TIDY_BIN -) +mark_as_advanced(CLANG_TIDY_BIN) if(CLANG_TIDY_FOUND) - # A CMake script to find all source files and setup clang-tidy targets for them - include(clang-tidy) + # A CMake script to find all source files and setup clang-tidy targets for + # them + include(clang-tidy) else() - message("clang-tidy not found. Not setting up tidy targets") + message("clang-tidy not found. Not setting up tidy targets") endif() diff --git a/cmake/FindXinerama.cmake b/cmake/FindXinerama.cmake index c6e66bf3..a2b54f36 100644 --- a/cmake/FindXinerama.cmake +++ b/cmake/FindXinerama.cmake @@ -1,7 +1,7 @@ -# - Find the Xinerama include file and library +# * Find the Xinerama include file and library # -SET(Xinerama_INC_SEARCH_PATH +set(Xinerama_INC_SEARCH_PATH /usr/X11R6/include /usr/local/include /usr/include/X11 @@ -10,36 +10,32 @@ SET(Xinerama_INC_SEARCH_PATH /opt/graphics/OpenGL/include /usr/include) -SET(Xinerama_LIB_SEARCH_PATH +set(Xinerama_LIB_SEARCH_PATH /usr/X11R6/lib /usr/local/lib /usr/openwin/lib /usr/lib) - -FIND_PATH(Xinerama_INCLUDE_DIR X11/extensions/Xinerama.h +find_path(Xinerama_INCLUDE_DIR X11/extensions/Xinerama.h ${Xinerama_INC_SEARCH_PATH}) -FIND_LIBRARY(Xinerama_LIBRARIES NAMES Xinerama PATH ${Xinerama_LIB_SEARCH_PATH}) +find_library(Xinerama_LIBRARIES NAMES Xinerama PATH ${Xinerama_LIB_SEARCH_PATH}) -IF (Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES) - SET(Xinerama_FOUND TRUE) -ENDIF (Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES) +if(Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES) + set(Xinerama_FOUND TRUE) +endif(Xinerama_INCLUDE_DIR AND Xinerama_LIBRARIES) -IF (Xinerama_FOUND) - INCLUDE(CheckLibraryExists) +if(Xinerama_FOUND) + include(CheckLibraryExists) - CHECK_LIBRARY_EXISTS(${Xinerama_LIBRARIES} - "XineramaQueryScreens" - ${Xinerama_LIBRARIES} - Xinerama_HAS_QUERY) + check_library_exists(${Xinerama_LIBRARIES} + "XineramaQueryScreens" + ${Xinerama_LIBRARIES} + Xinerama_HAS_QUERY) - IF (NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could NOT find Xinerama") - ENDIF (NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED) -ENDIF (Xinerama_FOUND) + if(NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find Xinerama") + endif(NOT Xinerama_HAS_QUERY AND Xinerama_FIND_REQUIRED) +endif(Xinerama_FOUND) -MARK_AS_ADVANCED( - Xinerama_INCLUDE_DIR - Xinerama_LIBRARIES -) +mark_as_advanced(Xinerama_INCLUDE_DIR Xinerama_LIBRARIES) diff --git a/cmake/ToLua.cmake b/cmake/ToLua.cmake index 329cff3a..6ba94306 100644 --- a/cmake/ToLua.cmake +++ b/cmake/ToLua.cmake @@ -3,56 +3,60 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # function(wrap_tolua VAR FIL) -SET(INCL) -SET(${VAR}) + set(INCL) + set(${VAR}) -GET_FILENAME_COMPONENT(ABS_FIL ${FIL} ABSOLUTE) -GET_FILENAME_COMPONENT(FIL_WE ${FIL} NAME_WE) -LIST(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c") + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + list(APPEND ${VAR} "${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c") -if(DEFINED ARGV2) - GET_FILENAME_COMPONENT(PATCH ${ARGV2} ABSOLUTE) - SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.c) - ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c - COMMAND ${APP_PATCH} -s ${TOLUA_OUT} ${PATCH} -o ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c - DEPENDS ${TOLUA_OUT} ${PATCH} - COMMENT "Patching lib${FIL_WE}-orig.c" - VERBATIM) - SET_SOURCE_FILES_PROPERTIES(${TOLUA_OUT} PROPERTIES GENERATED TRUE) -else() - SET(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c) -endif(DEFINED ARGV2) + if(DEFINED ARGV2) + get_filename_component(PATCH ${ARGV2} ABSOLUTE) + set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.c) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c + COMMAND ${APP_PATCH} -s ${TOLUA_OUT} ${PATCH} -o + ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c + DEPENDS ${TOLUA_OUT} ${PATCH} + COMMENT "Patching lib${FIL_WE}-orig.c" + VERBATIM) + set_source_files_properties(${TOLUA_OUT} PROPERTIES GENERATED TRUE) + else() + set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.c) + endif(DEFINED ARGV2) -# Call toluapp from 3rdparty/ path directly. -# The last argument to toluapp is the path to the tolua Lua sources. -ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND - toluapp -n - ${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} - ${CMAKE_SOURCE_DIR}/3rdparty/toluapp/src/bin/lua/ - DEPENDS ${ABS_FIL} COMMENT "Running tolua++ on ${FIL}" - VERBATIM ) + # Call toluapp from 3rdparty/ path directly. The last argument to toluapp is + # the path to the tolua Lua sources. + add_custom_command(OUTPUT ${TOLUA_OUT} ${INCL} + COMMAND toluapp -n ${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL} + ${CMAKE_SOURCE_DIR}/3rdparty/toluapp/src/bin/lua/ + DEPENDS ${ABS_FIL} + COMMENT "Running tolua++ on ${FIL}" + VERBATIM) -SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE) -SET_SOURCE_FILES_PROPERTIES(${${VAR}} PROPERTIES COMPILE_FLAGS "-Wno-bad-function-cast -Wno-unused-parameter -Wno-cast-qual -Wno-error=pedantic") + set_source_files_properties(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE) + set_source_files_properties( + ${${VAR}} + PROPERTIES + COMPILE_FLAGS + "-Wno-bad-function-cast -Wno-unused-parameter -Wno-cast-qual -Wno-error=pedantic" + ) - -SET(${VAR} ${${VAR}} PARENT_SCOPE) + set(${VAR} ${${VAR}} PARENT_SCOPE) endfunction(wrap_tolua) diff --git a/cmake/clang-tidy.cmake b/cmake/clang-tidy.cmake index 1f0a202a..940775f4 100644 --- a/cmake/clang-tidy.cmake +++ b/cmake/clang-tidy.cmake @@ -1,16 +1,15 @@ # Run clang-tidy set(DO_CLANG_TIDY - "${CLANG_TIDY_BIN}" - -format-style='{BasedOnStyle: google, IndentWidth: 2}' - -checks=*,-clang-analyzer-alpha.* - -fix - -fix-errors -) + "${CLANG_TIDY_BIN}" + -format-style='{BasedOnStyle: + google, + IndentWidth: + 2}' + -checks=*,-clang-analyzer-alpha.* + -fix + -fix-errors) if(CLANG_TIDY_BIN) - set_target_properties( - conky PROPERTIES - CXX_CLANG_TIDY "${DO_CLANG_TIDY}" - ) + set_target_properties(conky PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}") endif() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 87659d9f..412adc3a 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -3,43 +3,43 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # if(BUILD_BUILTIN_CONFIG) - # generate defconfig - if(BUILD_X11) - set(builtin_config conky.conf) - else(BUILD_X11) - set(builtin_config conky_no_x11.conf) - endif(BUILD_X11) - add_custom_command(OUTPUT defconfig.h COMMAND - ${CMAKE_SOURCE_DIR}/bin/text2c.sh ${CMAKE_CURRENT_SOURCE_DIR}/${builtin_config} - defconfig.h defconfig DEPENDS ${builtin_config} - ) - add_custom_target(defconfig ALL DEPENDS defconfig.h) - set_source_files_properties(defconfig.h PROPERTIES GENERATED TRUE) + # generate defconfig + if(BUILD_X11) + set(builtin_config conky.conf) + else(BUILD_X11) + set(builtin_config conky_no_x11.conf) + endif(BUILD_X11) + add_custom_command(OUTPUT defconfig.h + COMMAND ${CMAKE_SOURCE_DIR}/bin/text2c.sh + ${CMAKE_CURRENT_SOURCE_DIR}/${builtin_config} + defconfig.h defconfig + DEPENDS ${builtin_config}) + add_custom_target(defconfig ALL DEPENDS defconfig.h) + set_source_files_properties(defconfig.h PROPERTIES GENERATED TRUE) endif(BUILD_BUILTIN_CONFIG) if(BUILD_OLD_CONFIG) - add_custom_command(OUTPUT convertconf.h COMMAND - ${CMAKE_SOURCE_DIR}/bin/text2c.sh ${CMAKE_SOURCE_DIR}/extras/convert.lua - convertconf.h convertconf DEPENDS ${CMAKE_SOURCE_DIR}/extras/convert.lua - ) - add_custom_target(convertconf ALL DEPENDS convertconf.h) - set_source_files_properties(convertconf.h PROPERTIES GENERATED TRUE) + add_custom_command(OUTPUT convertconf.h + COMMAND ${CMAKE_SOURCE_DIR}/bin/text2c.sh + ${CMAKE_SOURCE_DIR}/extras/convert.lua + convertconf.h convertconf + DEPENDS ${CMAKE_SOURCE_DIR}/extras/convert.lua) + add_custom_target(convertconf ALL DEPENDS convertconf.h) + set_source_files_properties(convertconf.h PROPERTIES GENERATED TRUE) endif(BUILD_OLD_CONFIG) - diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 74189bfc..dcbcbb88 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,25 +3,24 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # include(Docbook) if(MAINTAINER_MODE) - wrap_xsltproc(lua config_settings variables) - wrap_man(docs) + wrap_xsltproc(lua config_settings variables) + wrap_man(docs) endif(MAINTAINER_MODE) diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index 295ed3ec..d35b0216 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -3,19 +3,18 @@ # # Please see COPYING for details # -# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) -# All rights reserved. +# Copyright (c) 2005-2018 Brenden Matthews, et. al. (see AUTHORS) All rights +# reserved. # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. You should have received a copy of the GNU General Public License # along with this program. If not, see . # @@ -25,66 +24,69 @@ add_definitions(-DTOLUA_RELEASE) if(BUILD_X11) - if(BUILD_LUA_CAIRO) - include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR}) + if(BUILD_LUA_CAIRO) + include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR}) - # Need the directory for -lSM - get_filename_component(X11_SM_LIB_PATH ${X11_SM_LIB} DIRECTORY) - link_directories(${X11_SM_LIB_PATH}) + # Need the directory for -lSM + get_filename_component(X11_SM_LIB_PATH ${X11_SM_LIB} DIRECTORY) + link_directories(${X11_SM_LIB_PATH}) - # cairo_set_dash() needs this special hack to work properly - # if you have a better solution, please let me know - wrap_tolua(luacairo_src cairo.pkg libcairo.patch) + # cairo_set_dash() needs this special hack to work properly if you have a + # better solution, please let me know + wrap_tolua(luacairo_src cairo.pkg libcairo.patch) - add_library(conky-cairo SHARED ${luacairo_src}) - set_target_properties(conky-cairo PROPERTIES OUTPUT_NAME "cairo") + add_library(conky-cairo SHARED ${luacairo_src}) + set_target_properties(conky-cairo PROPERTIES OUTPUT_NAME "cairo") - target_link_libraries(conky-cairo ${luacairo_libs} toluapp_lib_static) - set(lua_libs ${lua_libs} conky-cairo) + target_link_libraries(conky-cairo ${luacairo_libs} toluapp_lib_static) + set(lua_libs ${lua_libs} conky-cairo) - print_target_properties(conky-cairo) - endif(BUILD_LUA_CAIRO) + print_target_properties(conky-cairo) + endif(BUILD_LUA_CAIRO) - if(BUILD_LUA_IMLIB2) - include_directories(${luaimlib2_includes} ${CMAKE_CURRENT_SOURCE_DIR}) - wrap_tolua(luaimlib2_src imlib2.pkg) + if(BUILD_LUA_IMLIB2) + include_directories(${luaimlib2_includes} ${CMAKE_CURRENT_SOURCE_DIR}) + wrap_tolua(luaimlib2_src imlib2.pkg) - add_library(conky-imlib2 SHARED ${luaimlib2_src}) - set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME "imlib2") + add_library(conky-imlib2 SHARED ${luaimlib2_src}) + set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME "imlib2") - target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static) - set(lua_libs ${lua_libs} conky-imlib2) + target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static) + set(lua_libs ${lua_libs} conky-imlib2) - print_target_properties(conky-imlib2) - endif(BUILD_LUA_IMLIB2) + print_target_properties(conky-imlib2) + endif(BUILD_LUA_IMLIB2) - if(BUILD_LUA_RSVG) - include_directories(${luarsvg_includes} ${CMAKE_CURRENT_SOURCE_DIR}) - wrap_tolua(luarsvg_src rsvg.pkg) + if(BUILD_LUA_RSVG) + include_directories(${luarsvg_includes} ${CMAKE_CURRENT_SOURCE_DIR}) + wrap_tolua(luarsvg_src rsvg.pkg) - add_library(conky-rsvg SHARED ${luarsvg_src}) - set_target_properties(conky-rsvg PROPERTIES OUTPUT_NAME "rsvg") + add_library(conky-rsvg SHARED ${luarsvg_src}) + set_target_properties(conky-rsvg PROPERTIES OUTPUT_NAME "rsvg") - target_link_libraries(conky-rsvg ${luarsvg_libs} toluapp_lib_static) - set(lua_libs ${lua_libs} conky-rsvg) - - print_target_properties(conky-rsvg) - endif(BUILD_LUA_RSVG) + target_link_libraries(conky-rsvg ${luarsvg_libs} toluapp_lib_static) + set(lua_libs ${lua_libs} conky-rsvg) - if(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) - include_directories(${luacairo_includes} ${luaimlib2_includes} ${CMAKE_CURRENT_SOURCE_DIR}) - wrap_tolua(luacairo_imlib2_helper_src cairo_imlib2_helper.pkg) + print_target_properties(conky-rsvg) + endif(BUILD_LUA_RSVG) - add_library(conky-cairo_imlib2_helper SHARED ${luacairo_imlib2_helper_src}) - set_target_properties(conky-cairo_imlib2_helper PROPERTIES OUTPUT_NAME "cairo_imlib2_helper") + if(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) + include_directories(${luacairo_includes} ${luaimlib2_includes} + ${CMAKE_CURRENT_SOURCE_DIR}) + wrap_tolua(luacairo_imlib2_helper_src cairo_imlib2_helper.pkg) - target_link_libraries(conky-cairo_imlib2_helper ${luacairo_libs} ${luaimlib2_libs} toluapp_lib_static) - set(lua_libs ${lua_libs} conky-cairo_imlib2_helper) - endif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) + add_library(conky-cairo_imlib2_helper SHARED ${luacairo_imlib2_helper_src}) + set_target_properties(conky-cairo_imlib2_helper + PROPERTIES OUTPUT_NAME "cairo_imlib2_helper") + + target_link_libraries(conky-cairo_imlib2_helper + ${luacairo_libs} + ${luaimlib2_libs} + toluapp_lib_static) + set(lua_libs ${lua_libs} conky-cairo_imlib2_helper) + endif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2) endif(BUILD_X11) -install(TARGETS - ${lua_libs} - LIBRARY DESTINATION ${LIB_INSTALL_DIR}/conky - ARCHIVE DESTINATION ${LIB_INSTALL_DIR}/conky -) +install(TARGETS ${lua_libs} + LIBRARY DESTINATION ${LIB_INSTALL_DIR}/conky + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}/conky)