Permalink
Browse files

Style: Reformat CMake code with cmake-format 0.4.3

  • Loading branch information...
sanssecours committed Sep 17, 2018
1 parent 7623f73 commit 4e73b9a0c05b1f7c9d6ec2d90efd2c53c4116170
@@ -351,7 +351,7 @@ before_install:
sudo apt-get install libzmq3-dev
sudo apt-get install libxerces-c-dev
sudo apt-get install moreutils # contains `sponge` required by `reformat-cmake`
sudo pip install --upgrade cmake_format==0.4.1 pyyaml
sudo pip install cmake-format==0.4.3 pyyaml
fi
#
@@ -37,7 +37,9 @@ if (NOT WIN32)
endif (NOT WIN32)
# exclude the OPMPHM benchmarks from mingw
if (ENABLE_OPTIMIZATIONS AND NOT WIN32)
if (ENABLE_OPTIMIZATIONS
AND NOT
WIN32)
# set USE_OPENMP here and define it in opmphm.c
set (USE_OPENMP 0)
@@ -6,10 +6,8 @@ include (CMakePackageConfigHelpers)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/ElektraConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/ElektraConfig.cmake" @ONLY)
write_basic_package_version_file ("${CMAKE_CURRENT_BINARY_DIR}/ElektraConfigVersion.cmake"
VERSION
${KDB_VERSION}
COMPATIBILITY
AnyNewerVersion)
VERSION ${KDB_VERSION}
COMPATIBILITY AnyNewerVersion)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/ElektraConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ElektraConfigVersion.cmake"
@@ -126,7 +126,9 @@ if (ENABLE_ASAN)
set (EXTRA_FLAGS "${EXTRA_FLAGS} -fsanitize-blacklist=\"${CMAKE_SOURCE_DIR}/tests/sanitizer.blacklist\"")
# in case the ubsan library exists, link it otherwise some tests will fail due to missing symbols on unix
if (UNIX AND NOT APPLE)
if (UNIX
AND NOT
APPLE)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lubsan")
endif (UNIX AND NOT APPLE)
endif ()
@@ -4,7 +4,10 @@
find_program (COVERAGE_LCOV lcov)
find_program (COVERAGE_AWK awk)
if (EXISTS ${COVERAGE_LCOV} AND EXISTS ${COVERAGE_AWK})
if (EXISTS
${COVERAGE_LCOV}
AND EXISTS
${COVERAGE_AWK})
# make all invocations of lcov and genhtml quiet
set (COMMON_FLAGS "-q")
@@ -53,7 +53,10 @@ string (REGEX
"${files}")
foreach (file ${files})
message (STATUS "Uninstalling $ENV{DESTDIR}${file}")
if (IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
if (IS_SYMLINK
"$ENV{DESTDIR}${file}"
OR EXISTS
"$ENV{DESTDIR}${file}")
execute_process (COMMAND "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval)
@@ -133,7 +133,9 @@ set (CABAL_CUSTOM_SETUP "custom-setup
set (HASKELL_SHARED_SANDBOX "$ENV{HASKELL_SHARED_SANDBOX}/.cabal-sandbox")
get_filename_component (HASKELL_SHARED_SANDBOX "${HASKELL_SHARED_SANDBOX}" REALPATH)
if (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
if (HASKELL_SHARED_SANDBOX
AND IS_DIRECTORY
"${HASKELL_SHARED_SANDBOX}")
set (HASKELL_FOUND 1)
else (HASKELL_SHARED_SANDBOX AND IS_DIRECTORY "${HASKELL_SHARED_SANDBOX}")
if (IS_DIRECTORY "${CMAKE_BINARY_DIR}/.cabal-sandbox")
@@ -60,7 +60,10 @@ if (WIN32)
PATH
${ICONV_INCLUDE_DIR}/../bin)
if (ICONV_FIND_REQUIRED)
if (NOT ICONV_DLL AND NOT ICONV_DLL_HELP)
if (NOT
ICONV_DLL
AND NOT
ICONV_DLL_HELP)
message (FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")
endif ()
if (NOT ICONV_DLL AND ICONV_DLL_HELP)
@@ -40,7 +40,10 @@ if (LIBGCRYPTCONFIG_EXECUTABLE)
OUTPUT_VARIABLE LIBGCRYPT_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
if (NOT
LIBGCRYPT_CFLAGS
AND NOT
_return_VALUE)
set (LIBGCRYPT_CFLAGS " ")
endif (NOT LIBGCRYPT_CFLAGS AND NOT _return_VALUE)
@@ -29,7 +29,10 @@ if (GPGME_EXECUTABLE)
OUTPUT_VARIABLE LIBGPGME_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT LIBGPGME_CFLAGS AND NOT _return_VALUE)
if (NOT
LIBGPGME_CFLAGS
AND NOT
_return_VALUE)
set (LIBGPGME_CFLAGS " ")
endif (NOT LIBGPGME_CFLAGS AND NOT _return_VALUE)
@@ -15,7 +15,10 @@
if (NOT OPENSSL_FOUND)
include (FindPkgConfig)
if (APPLE AND NOT DEFINED ENV{PKG_CONFIG_PATH})
if (APPLE
AND NOT
DEFINED
ENV{PKG_CONFIG_PATH})
# Add default pkg-config path of Homebrew’s OpenSSL version
set (ENV{PKG_CONFIG_PATH} "/usr/local/opt/openssl/lib/pkgconfig")
endif (APPLE AND NOT DEFINED ENV{PKG_CONFIG_PATH})
@@ -172,7 +172,11 @@ unset (_lua_library_names)
if (LUA_LIBRARY)
if (UNIX AND NOT APPLE AND NOT BEOS) # include the math library for Unix
if (UNIX
AND NOT
APPLE
AND NOT
BEOS) # include the math library for Unix
find_library (LUA_MATH_LIBRARY m)
set (LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
@@ -181,7 +185,9 @@ if (LUA_LIBRARY)
endif ()
endif ()
if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
if (LUA_INCLUDE_DIR
AND EXISTS
"${LUA_INCLUDE_DIR}/lua.h")
# At least 5.[012] have different ways to express the version so all of them need to be tested. Lua 5.2 defines LUA_VERSION and
# LUA_RELEASE as joined by the C preprocessor, so avoid those.
@@ -123,7 +123,11 @@ foreach (_CURRENT_VERSION ${_Python2_VERSIONS})
)
# For backward compatibility, honour value of PYTHON2_INCLUDE_PATH, if PYTHON2_INCLUDE_DIR is not set.
if (DEFINED PYTHON2_INCLUDE_PATH AND NOT DEFINED PYTHON2_INCLUDE_DIR)
if (DEFINED
PYTHON2_INCLUDE_PATH
AND NOT
DEFINED
PYTHON2_INCLUDE_DIR)
set (PYTHON2_INCLUDE_DIR
"${PYTHON2_INCLUDE_PATH}"
CACHE PATH
@@ -132,7 +136,9 @@ foreach (_CURRENT_VERSION ${_Python2_VERSIONS})
endif (DEFINED PYTHON2_INCLUDE_PATH AND NOT DEFINED PYTHON2_INCLUDE_DIR)
set (PYTHON2_FRAMEWORK_INCLUDES)
if (Python_FRAMEWORKS AND NOT PYTHON2_INCLUDE_DIR)
if (Python_FRAMEWORKS
AND NOT
PYTHON2_INCLUDE_DIR)
foreach (dir ${Python_FRAMEWORKS})
set (PYTHON2_FRAMEWORK_INCLUDES
${PYTHON2_FRAMEWORK_INCLUDES}
@@ -153,7 +159,9 @@ foreach (_CURRENT_VERSION ${_Python2_VERSIONS})
# For backward compatibility, set PYTHON2_INCLUDE_PATH.
set (PYTHON2_INCLUDE_PATH "${PYTHON2_INCLUDE_DIR}")
if (PYTHON2_INCLUDE_DIR AND EXISTS "${PYTHON2_INCLUDE_DIR}/patchlevel.h")
if (PYTHON2_INCLUDE_DIR
AND EXISTS
"${PYTHON2_INCLUDE_DIR}/patchlevel.h")
file (STRINGS "${PYTHON2_INCLUDE_DIR}/patchlevel.h"
python_version_str
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
@@ -221,7 +229,9 @@ function (PYTHON2_ADD_MODULE _NAME)
set_target_properties (${_NAME}
PROPERTIES PREFIX
"${PYTHON2_MODULE_PREFIX}")
if (WIN32 AND NOT CYGWIN)
if (WIN32
AND NOT
CYGWIN)
set_target_properties (${_NAME}
PROPERTIES SUFFIX
".pyd")
@@ -115,15 +115,19 @@ macro (add_haskell_plugin target)
DEPENDS ${target}
c2hs_haskell)
if (DEPENDENCY_PHASE AND TARGET elektra-${target})
if (DEPENDENCY_PHASE
AND TARGET
elektra-${target})
set_target_properties (elektra-${target}
PROPERTIES INSTALL_RPATH
"${HASKELL_RPATH}"
SANDBOX_PACKAGEDB
"${SANDBOX_PACKAGEDB}")
endif (DEPENDENCY_PHASE AND TARGET elektra-${target})
if (ADDTESTING_PHASE AND TARGET elektra-${target})
if (ADDTESTING_PHASE
AND TARGET
elektra-${target})
set (PLUGINTEST_ARGS "")
if (ARG_INSTALL_TEST_DATA)
list (APPEND PLUGINTEST_ARGS
@@ -212,7 +216,9 @@ macro (prepare_and_compile_haskell_plugin target PLUGIN_NAME PLUGIN_NAME_CAPITAL
if (GHC_BASE_LIB)
if (GHC_GMP_LIB)
if (GHC_PRIM_LIB)
if (GHC_FFI_LIB OR NOT APPLE)
if (GHC_FFI_LIB
OR NOT
APPLE)
compile_haskell_plugin (${target}
${PLUGIN_HASKELL_NAME}
SANDBOX_ADD_SOURCES
@@ -693,7 +693,12 @@ function (generate_readme p) # rerun cmake when README.md is changed also allow
"keyNew(\"system/elektra/modules/${p}/infos/needs\",\nKEY_VALUE, \"\\1\", KEY_END),"
contents
"${contents}")
if (p STREQUAL ${KDB_DEFAULT_STORAGE} OR p STREQUAL KDB_DEFAULT_RESOLVER)
if (p
STREQUAL
${KDB_DEFAULT_STORAGE}
OR p
STREQUAL
KDB_DEFAULT_RESOLVER)
string (REGEX
REPLACE "\"- +infos/status *= *([-a-zA-Z0-9 ]*)\\\\n\""
"keyNew(\"system/elektra/modules/${p}/infos/status\",\nKEY_VALUE, \"\\1 default\", KEY_END),"
@@ -153,7 +153,11 @@ function (add_plugintest testname)
foreach (DIR ${ARG_INCLUDE_SYSTEM_DIRECTORIES})
if (DIR AND NOT DIR STREQUAL "/usr/include")
if (DIR
AND NOT
DIR
STREQUAL
"/usr/include")
set_property (TARGET ${testexename}
APPEND_STRING
PROPERTY COMPILE_FLAGS
@@ -395,7 +399,9 @@ function (add_plugin PLUGIN_SHORT_NAME)
endif ()
if (ADDTESTING_PHASE)
if (ARG_INSTALL_TEST_DATA AND NOT ARG_ADD_TEST)
if (ARG_INSTALL_TEST_DATA
AND NOT
ARG_ADD_TEST)
if (INSTALL_TESTING)
install (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${PLUGIN_SHORT_NAME}"
DESTINATION "${TARGET_TEST_DATA_FOLDER}")
@@ -516,7 +522,9 @@ function (add_plugin PLUGIN_SHORT_NAME)
# message (STATUS "current bin ${CMAKE_CURRENT_BINARY_DIR}")
# ~~~
if (ARG_ONLY_SHARED AND NOT BUILD_SHARED)
if (ARG_ONLY_SHARED
AND NOT
BUILD_SHARED)
remove_plugin ("${PLUGIN_SHORT_NAME}"
"it can only be built if BUILD_SHARED is enabled, both BUILD_FULL or BUILD_STATIC may be enabled as well")
return ()
@@ -570,7 +578,11 @@ function (add_plugin PLUGIN_SHORT_NAME)
)
foreach (DIR ${ARG_INCLUDE_SYSTEM_DIRECTORIES})
if (DIR AND NOT DIR STREQUAL "/usr/include")
if (DIR
AND NOT
DIR
STREQUAL
"/usr/include")
set_property (TARGET ${PLUGIN_OBJS}
APPEND_STRING
PROPERTY COMPILE_FLAGS
@@ -609,7 +621,11 @@ function (add_plugin PLUGIN_SHORT_NAME)
${CMAKE_CURRENT_BINARY_DIR} # for readme
)
foreach (DIR ${ARG_INCLUDE_SYSTEM_DIRECTORIES})
if (DIR AND NOT DIR STREQUAL "/usr/include")
if (DIR
AND NOT
DIR
STREQUAL
"/usr/include")
set_property (TARGET ${PLUGIN_NAME}
APPEND_STRING
PROPERTY COMPILE_FLAGS
@@ -252,6 +252,7 @@ you up to date with the multi-language support provided by Elektra.
- Provide a wrapper around `check_symbol_exists` that handles issues with
`-Werror -Wpedantic`. *(Lukas Winkler)*
- The argument `INCLUDE_SYSTEM_DIRECTORIES` of the function `add_plugin` now supports multiple include directories. *(René Schwaiger)*
- We reformatted all CMake source files with cmake-format 0.4.3. *(René Schwaiger)*
### Docker
@@ -61,7 +61,7 @@ RUN apt-get update && apt-get -y install \
&& rm -rf /var/lib/apt/lists/*
RUN cabal update && cabal install hspec QuickCheck
RUN pip install --upgrade cmake_format==0.4.1 pyyaml
RUN pip install cmake-format==0.4.3 pyyaml
# Google Test
ENV GTEST_ROOT=/opt/gtest
@@ -82,7 +82,7 @@ Vagrant.configure("2") do |config|
apt-get -y upgrade
apt-get -y install curl build-essential autotools-dev automake cmake pkg-config doxygen graphviz bison ruby-dev python-dev python3-dev liblua5.2-dev tclcl-dev libaugeas-dev libyajl-dev libgit2-dev libboost-all-dev libssl-dev libcurl4-gnutls-dev libdbus-1-dev libpcre3-dev libpcre++-dev checkinstall vim valgrind clang-5.0 clang-format-5.0 htop zlib1g-dev git openjdk-8-jdk python-pip locales bison libpython3-dev liblua5.3-dev libxerces-c-dev swig
pip install --upgrade cmake_format==0.4.1 pyyaml
pip install cmake-format==0.4.3 pyyaml
mkdir -p /opt/gtest \
&& cd /tmp \
@@ -9,7 +9,10 @@ if (IS_PYTHON_INCLUDED OR IS_LUA_INCLUDED)
if (INTROSPECTION_FOUND)
if (ENABLE_ASAN AND UNIX AND NOT APPLE)
if (ENABLE_ASAN
AND UNIX
AND NOT
APPLE)
set (ASAN_LIBRARY "-lubsan") # this is needed for GIR to put asan in front
set (DISABLE_LSAN "LSAN_OPTIONS=detect_leaks=0") # this is needed so ASAN is not used during GIR compilation
endif (ENABLE_ASAN AND UNIX AND NOT APPLE)
@@ -48,7 +48,9 @@ if (Java_JAVAC_EXECUTABLE)
DESTINATION "share/java")
# and add maven test to execute with ctest in the testing phase
if ((CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND NOT (CMAKE_SYSTEM_VERSION VERSION_LESS 15))
if ((CMAKE_SYSTEM_NAME STREQUAL "Darwin")
AND NOT
(CMAKE_SYSTEM_VERSION VERSION_LESS 15))
# we cannot set DYLD_LIBRARY_PATH on new macOS versions, making the kdb tests fail if its not installed in
# the system
@@ -1,7 +1,9 @@
include (LibAddMacros)
# Clang with enabled ASAN reports that this test leaks memory: https://travis-ci.org/sanssecours/elektra/jobs/383014685#L2197
if (BUILD_TESTING AND NOT ENABLE_ASAN)
if (BUILD_TESTING
AND NOT
ENABLE_ASAN)
add_headers (HDR_FILES)
@@ -31,7 +31,12 @@ file (GLOB DIRECTORIES
foreach (plugin ${DIRECTORIES})
# message (STATUS ${plugin})
if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${plugin} AND NOT ${plugin} STREQUAL CMakeFiles)
if (IS_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/${plugin}
AND NOT
${plugin}
STREQUAL
CMakeFiles)
set (CMAKE_CURRENT_SOURCE_DIR_TOPSAFE ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_CURRENT_BINARY_DIR_TOPSAFE ${CMAKE_CURRENT_BINARY_DIR})
set (PLUGIN_DIRECTORY_NAME ${plugin})
@@ -3,7 +3,12 @@ include (LibAddMacros)
if (DEPENDENCY_PHASE)
# The plugin does not work correctly if we compile it with GCC 4.7
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
if (CMAKE_CXX_COMPILER_ID
MATCHES
"GNU"
AND CMAKE_CXX_COMPILER_VERSION
VERSION_LESS
4.8)
remove_plugin (date "gcc version too old (gcc -dumpversion < 4.8)")
endif (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
endif (DEPENDENCY_PHASE)
Oops, something went wrong.

0 comments on commit 4e73b9a

Please sign in to comment.