]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CMake: SALOME_PACKAGE_REPORT_AND_CHECK now works if no OPTIONAL package was specified.
authorbruneton <bruneton>
Mon, 21 Oct 2013 08:57:26 +0000 (08:57 +0000)
committerbruneton <bruneton>
Mon, 21 Oct 2013 08:57:26 +0000 (08:57 +0000)
salome_adm/cmake_files/SalomeMacros.cmake

index c5e0a106ae26b763d7bcb504d2fec0c6c3a2573b..29bca1f9fc6e1be9cddc2ba41be57a42469b5728 100755 (executable)
@@ -292,25 +292,27 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK)
   MESSAGE(STATUS "  Optional packages - Detection report ")
   MESSAGE(STATUS "  ==================================== ")
   MESSAGE(STATUS "")
-  LIST(LENGTH _SALOME_OPTIONAL_PACKAGES_names _list_len)
-  # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
-  MATH(EXPR _range "${_list_len}-1")
-  FOREACH(_idx RANGE ${_range})  
-    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 "")
-    ELSE()
-      SET(_will_fail ON)
-      SET(_found_msg "NOT Found")
-      SET(_flag_msg " - ${_pkg_flag} can be switched OFF to skip this prerequisite.")
-    ENDIF()
+  IF(DEFINED _SALOME_OPTIONAL_PACKAGES_names)
+    LIST(LENGTH _SALOME_OPTIONAL_PACKAGES_names _list_len)
+    # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
+    MATH(EXPR _range "${_list_len}-1")
+    FOREACH(_idx RANGE ${_range})  
+      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 "")
+      ELSE()
+        SET(_will_fail ON)
+        SET(_found_msg "NOT Found")
+        SET(_flag_msg " - ${_pkg_flag} can be switched OFF to skip this prerequisite.")
+      ENDIF()
     
-    MESSAGE(STATUS "  * ${_pkg_name}  ->  ${_found_msg}${_flag_msg}")
-  ENDFOREACH()
+      MESSAGE(STATUS "  * ${_pkg_name}  ->  ${_found_msg}${_flag_msg}")
+    ENDFOREACH()
+  ENDIF(DEFINED _SALOME_OPTIONAL_PACKAGES_names)
   MESSAGE(STATUS "")
   MESSAGE(STATUS "")