From 9f540ed348e3a3ef01951208211603a07fd574d6 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sat, 18 Aug 2018 14:36:57 +0200 Subject: cmake: highlight warning and error messages Change-Id: Id4b73368382b5e78c138987fe092429af5cb0afd Signed-off-by: Damjan Marion --- src/CMakeLists.txt | 23 +++++++++++++++++++++++ src/plugins/dpdk/CMakeLists.txt | 6 +++--- src/plugins/marvell/CMakeLists.txt | 5 ++--- src/plugins/tlsmbedtls/CMakeLists.txt | 6 +++--- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13ae93d6e24..e0527543c94 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,6 +17,29 @@ project(vpp C) include(CheckCCompilerFlag) +############################################################################## +# Highlight WARNING and ERROR messages +############################################################################## +function(message) + list(GET ARGV 0 type) + string(ASCII 27 esc) + set(red "${esc}[1;31m") + set(yellow "${esc}[1;33m") + set(reset "${esc}[m") + if(type STREQUAL FATAL_ERROR OR type STREQUAL SEND_ERROR) + list(REMOVE_AT ARGV 0) + _message(${type} "${red}${ARGV}${reset}") + elseif(type STREQUAL WARNING) + list(REMOVE_AT ARGV 0) + _message(STATUS "${yellow}${ARGV}${reset}") + elseif(type STREQUAL STATUS) + list(REMOVE_AT ARGV 0) + _message(STATUS "${ARGV}") + else() + _message(${ARGV}) + endif() +endfunction() + ############################################################################## # CPU optimizations and multiarch support ############################################################################## diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt index 5f468110e50..66407041eae 100644 --- a/src/plugins/dpdk/CMakeLists.txt +++ b/src/plugins/dpdk/CMakeLists.txt @@ -109,16 +109,16 @@ if(DPDK_INCLUDE_DIR AND DPDK_LIB) device/node.c ) - message("-- Found DPDK ${DPDK_VERSION} in ${DPDK_INCLUDE_DIR}") + message(STATUS "Found DPDK ${DPDK_VERSION} in ${DPDK_INCLUDE_DIR}") get_filename_component(DPDK_LIB_DIR ${DPDK_LIB} DIRECTORY) set(DPDK_LINK_FLAGS "-L${DPDK_LIB_DIR} -Wl,--whole-archive,${DPDK_LIB},--no-whole-archive") if(DPDK_RTE_LIBRTE_PMD_AESNI_MB OR DPDK_RTE_LIBRTE_PMD_AESNI_GCM) set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,--exclude-libs,libIPSec_MB.a,-l:libIPSec_MB.a") - message("-- DPDK depends on IPSec MB library") + message(STATUS "DPDK depends on IPSec MB library") endif() set(DPDK_LINK_FLAGS "${DPDK_LINK_FLAGS} -Wl,-lnuma") set_target_properties(dpdk_plugin PROPERTIES LINK_FLAGS "${DPDK_LINK_FLAGS}") else() - message("-- DPDK not found - dpdk_plugin disabled") + message(WARNING "DPDK not found - dpdk_plugin disabled") endif() diff --git a/src/plugins/marvell/CMakeLists.txt b/src/plugins/marvell/CMakeLists.txt index 283a1aa000d..8767a4fd2b6 100644 --- a/src/plugins/marvell/CMakeLists.txt +++ b/src/plugins/marvell/CMakeLists.txt @@ -11,7 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -message("-- Looking for Marvell musdk") find_path(MUSDK_INCLUDE_DIR NAMES marvell/pp2/pp2.h) find_library(MUSDK_LIB NAMES musdk) @@ -26,7 +25,7 @@ if(MUSDK_INCLUDE_DIR AND MUSDK_LIB) pp2/pp2.c ) include_directories(${MUSDK_INCLUDE_DIR}) - message("-- Looking for Marvell musdk - found") + message(STATUS "Found Marvel MUSDK in ${MUSDK_INCLUDE_DIR}") else() - message("-- Looking for Marvell musdk - not found - marvell_plugin disabled") + message(WARNING "Marvell MUSDK not found - marvell_plugin disabled") endif() diff --git a/src/plugins/tlsmbedtls/CMakeLists.txt b/src/plugins/tlsmbedtls/CMakeLists.txt index 6b65f8fecb9..03f8a17fe86 100644 --- a/src/plugins/tlsmbedtls/CMakeLists.txt +++ b/src/plugins/tlsmbedtls/CMakeLists.txt @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -message("-- Looking for mbedTLS") +message(STATUS "Looking for mbedTLS") find_path(MBEDTLS_INCLUDE_DIR NAMES mbedtls/ssl.h) find_library(MBEDTLS_LIB1 NAMES mbedtls) find_library(MBEDTLS_LIB2 NAMES mbedx509) @@ -23,8 +23,8 @@ if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIB) include_directories(${MBEDTLS_INCLUDE_DIR}) add_vpp_plugin(tlsmbedtls_plugin tls_mbedtls.c) target_link_libraries(tlsmbedtls_plugin ${MBEDTLS_LIB}) - message("-- Found mbedTLS in ${MBEDTLS_INCLUDE_DIR}") + message(STATUS "Found mbedTLS in ${MBEDTLS_INCLUDE_DIR}") else() - message("-- mbedTLS not found - tlsmbedtls_plugin disabled") + message(WARNING "-- mbedTLS not found - tlsmbedtls_plugin disabled") endif() -- cgit 1.2.3-korg