cmake: highlight warning and error messages 41/14341/1
authorDamjan Marion <damarion@cisco.com>
Sat, 18 Aug 2018 12:36:57 +0000 (14:36 +0200)
committerDamjan Marion <damarion@cisco.com>
Sat, 18 Aug 2018 12:36:58 +0000 (14:36 +0200)
Change-Id: Id4b73368382b5e78c138987fe092429af5cb0afd
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/CMakeLists.txt
src/plugins/dpdk/CMakeLists.txt
src/plugins/marvell/CMakeLists.txt
src/plugins/tlsmbedtls/CMakeLists.txt

index 13ae93d..e052754 100644 (file)
@@ -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
 ##############################################################################
index 5f46811..6640704 100644 (file)
@@ -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()
 
index 283a1aa..8767a4f 100644 (file)
@@ -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()
index 6b65f8f..03f8a17 100644 (file)
@@ -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()