Salome HOME
Synchronize adm files
authorinv <inv@opencascade.com>
Wed, 2 Oct 2013 17:17:28 +0000 (17:17 +0000)
committerinv <inv@opencascade.com>
Wed, 2 Oct 2013 17:17:28 +0000 (17:17 +0000)
adm_local_without_kernel/cmake_files/SalomeMacros.cmake

index 012851b47484f23242eb6ea2f51962ef84e3c413..6167a1290e05eb3dcff034f6ab1d16555656d973 100755 (executable)
@@ -485,8 +485,12 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
   ENDIF()
 
   # Otherwise try the standard way (module mode, with the standard CMake Find*** macro):
-  # We do it quietly to produce our own error message:
-  SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE TRUE)
+  # We do it quietly to produce our own error message, except if we are in debug mode:
+  IF(SALOME_CMAKE_DEBUG)
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE FALSE)
+  ELSE()
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE TRUE)
+  ENDIF()
   
   # Set the "FOUND" variable for the SALOME wrapper:
   IF(${pkg_UC}_FOUND OR ${pkg}_FOUND)
@@ -496,10 +500,12 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
     IF(NOT Salome${pkg}_FIND_QUIETLY)
       IF(Salome${pkg}_FIND_REQUIRED)
          MESSAGE(FATAL_ERROR "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
-         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}")
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
       ELSE()
          MESSAGE(WARNING "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
-         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}")
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
       ENDIF()
     ENDIF()
   ENDIF()
@@ -509,10 +515,10 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
     ## from the given reference path. The variable "referenceVariable" may be a list.
     ## In this case we take its first element. 
     
-    # First test if the variable exists and is not empty:
-    IF((NOT DEFINED ${referenceVariable}) OR ("${${referenceVariable}}" STREQUAL ""))
+    # First test if the variable exists, warn otherwise:
+    IF(NOT DEFINED ${referenceVariable})
       MESSAGE(WARNING "${pkg}: the reference variable '${referenceVariable}' used when calling the macro "
-      "SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() does not exist or is empty.")
+      "SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() is not defined.")
     ENDIF()
     
     LIST(LENGTH ${referenceVariable} _tmp_len)
@@ -522,9 +528,8 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
        #  Note the double de-reference of "referenceVariable":
        SET(_tmp_ROOT_DIR "${${referenceVariable}}")
     ENDIF()
-    IF(${upCount})
-      MATH(EXPR _rge "${upCount}-1") 
-      FOREACH(_unused RANGE ${_rge})        
+    IF(${upCount}) 
+      FOREACH(_unused RANGE 1 ${upCount})        
         GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
       ENDFOREACH()
     ENDIF()