]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
CMake: sync files with KERNEL after inclusion of JUSTIFY_STRING() macro
authorbruneton <bruneton>
Wed, 28 Aug 2013 12:06:24 +0000 (12:06 +0000)
committerbruneton <bruneton>
Wed, 28 Aug 2013 12:06:24 +0000 (12:06 +0000)
adm_local_without_kernel/cmake_files/SalomeMacros.cmake

index c056a22c4237cb53b0ba356c48a31ec58c5672d7..bcdf88c59e0b5c185e144870ebf706cff8886e90 100755 (executable)
@@ -247,12 +247,49 @@ MACRO(SALOME_UPDATE_FLAG_AND_LOG_PACKAGE pkg flag)
   ENDIF()  
 ENDMACRO(SALOME_UPDATE_FLAG_AND_LOG_PACKAGE)
 
+####
+# SALOME_JUSTIFY_STRING()
+#
+# Justifies the string specified as an argument to the given length
+# adding required number of spaces to the end. Does noting if input
+# string is longer as required length.
+# Puts the result to the output variable.
+#
+# USAGE: SALOME_JUSTIFY_STRING(input length result)
+#
+# ARGUMENTS:
+#   input  [in] input string
+#   length [in] required length of resulting string
+#   result [out] name of variable where the result string is put to
+#
+MACRO(SALOME_JUSTIFY_STRING input length result)
+  SET(${result} ${input})
+  STRING(LENGTH ${input} _input_length)
+  MATH(EXPR _nb_spaces "${length}-${_input_length}-1")
+  IF (_nb_spaces GREATER 0)
+    FOREACH(_idx RANGE ${_nb_spaces})  
+      SET(${result} "${${result}} ")
+    ENDFOREACH()
+  ENDIF()
+ENDMACRO(SALOME_JUSTIFY_STRING)
+
 ####
 # SALOME_PACKAGE_REPORT()
 #
 # Print a quick summary of the detection of optional prerequisites.
+# 
+# If optional JUSTIFY argument is specified, names of packages
+# are left-justified to the given length; default value is 10.
+#
+# USAGE: SALOME_PACKAGE_REPORT([JUSTIFY length])
 #
 MACRO(SALOME_PACKAGE_REPORT)
+  PARSE_ARGUMENTS(SALOME_PACKAGE_REPORT "JUSTIFY" "" ${ARGN})
+  IF(SALOME_PACKAGE_REPORT_JUSTIFY)
+    SET(_length ${SALOME_PACKAGE_REPORT_JUSTIFY})
+  ELSE()
+    SET(_length 10)
+  ENDIF()
   MESSAGE(STATUS "") 
   MESSAGE(STATUS "  Optional packages - Detection report ")
   MESSAGE(STATUS "  ==================================== ")
@@ -264,6 +301,7 @@ MACRO(SALOME_PACKAGE_REPORT)
     LIST(GET _SALOME_OPTIONAL_PACKAGES_names ${_idx} _pkg_name)
     LIST(GET _SALOME_OPTIONAL_PACKAGES_found ${_idx} _pkg_found)
     LIST(GET _SALOME_OPTIONAL_PACKAGES_flags ${_idx} _pkg_flag)
+    SALOME_JUSTIFY_STRING(${_pkg_name} ${_length} _pkg_name)
     IF(_pkg_found)
       SET(_found_msg "Found")
       SET(_flag_msg "")