diff options
author | Kosov Eugene <claprix@yandex.ru> | 2016-11-13 18:37:03 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2017-05-05 20:36:17 +0300 |
commit | a5feb98c47786e3825ec324d0d3bb403da448d4e (patch) | |
tree | b3f45e0036243cd4412b7b4b22f1d9f8102ac8fb | |
parent | d54d36c45e1eb14bb549dd225a28bea1d168754a (diff) | |
download | mariadb-git-a5feb98c47786e3825ec324d0d3bb403da448d4e.tar.gz |
Scripts: collect and reprint warnings
Closes #73
-rw-r--r-- | BUILD/capture_warnings.sh | 17 | ||||
-rw-r--r-- | CMakeLists.txt | 14 |
2 files changed, 31 insertions, 0 deletions
diff --git a/BUILD/capture_warnings.sh b/BUILD/capture_warnings.sh new file mode 100644 index 00000000000..88fd2576c05 --- /dev/null +++ b/BUILD/capture_warnings.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +warn_path=$1 +shift +warn_file="$warn_path/compile.warnings" + +set -o pipefail +exec 3>&1 +x=$(("$@" >&2) 2>&1 1>&3) +error=${PIPESTATUS} + +if ! [[ -z "$x" ]]; then + echo -n "$x" >> $warn_file + echo -n "$x" >&2 +fi + +exit ${error} diff --git a/CMakeLists.txt b/CMakeLists.txt index 869e65baf8d..a1dea914043 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -480,3 +480,17 @@ IF(NON_DISTRIBUTABLE_WARNING) MESSAGE(WARNING " You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.") ENDIF() + +IF (CMAKE_BUILD_TYPE MATCHES "Debug") + SET_DIRECTORY_PROPERTIES(PROPERTIES RULE_LAUNCH_COMPILE + "bash ${CMAKE_SOURCE_DIR}/BUILD/capture_warnings.sh ${CMAKE_BINARY_DIR}") + SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + "${CMAKE_BINARY_DIR}/compile.warnings") + ADD_CUSTOM_TARGET(REMOVE_WARNINGS_FILE ALL + COMMAND rm -f "compile.warnings" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + ADD_CUSTOM_TARGET(REPRINT ALL + COMMAND if [ -f "compile.warnings" ]; then cat "compile.warnings" \; fi + DEPENDS mysql udf_example explain_filename-t REMOVE_WARNINGS_FILE + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") +ENDIF() |