Browse Source

ctkMacroOptionUtils - Improve the enabling message

* It now displays the value of the variable within the logical expression
Jean-Christophe Fillion-Robin 13 years ago
parent
commit
fc24a2d1a5
1 changed files with 14 additions and 1 deletions
  1. 14 1
      CMake/ctkMacroOptionUtils.cmake

+ 14 - 1
CMake/ctkMacroOptionUtils.cmake

@@ -10,7 +10,20 @@ macro(ctk_option option_prefix name doc default)
       # option value, which requires the current option to be ON.
       get_property(_doc_string CACHE ${option_prefix}_${name} PROPERTY HELPSTRING)
       set(${option_prefix}_${name} ON CACHE BOOL ${_doc_string} FORCE)
-      message("Enabling [${option_prefix}_${name}] because of [${ARGN}]")
+      # Generate user-friendly message
+      set(enabling_msg)
+      foreach(arg ${ARGN})
+        if(NOT "${${arg}}" STREQUAL "")
+          set(value_as_int 0)
+          if(${${arg}})
+            set(value_as_int 1)
+          endif()
+          set(enabling_msg "${enabling_msg} ${arg}:${value_as_int}")
+        else()
+          set(enabling_msg "${enabling_msg} ${arg}")
+        endif()
+      endforeach()
+      message("Enabling [${option_prefix}_${name}] because of [${enabling_msg}] evaluates to True")
     endif()
   endif()
 endmacro()