]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
CMake: sync detection files with latest changes in KERNEL
authorbruneton <bruneton>
Tue, 30 Jul 2013 09:19:59 +0000 (09:19 +0000)
committerbruneton <bruneton>
Tue, 30 Jul 2013 09:19:59 +0000 (09:19 +0000)
adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake
adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake
adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake
adm_local_without_kernel/cmake_files/FindSphinx.cmake
adm_local_without_kernel/cmake_files/SalomeMacros.cmake

index fddffa31177acb30d349e6e112946f4dc7fa969d..cd3c5ce4b2db0f32ea8154dddfc0ad934a4be152 100644 (file)
@@ -25,4 +25,4 @@
 #
 
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CppUnit CPPUNIT_INCLUDE_DIRS 1)
-MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIRS CPPUNIT_LIBRARIES)
+MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIRS CPPUNIT_LIBRARIES CPPUNIT_CONFIG_BIN CPPUNIT_SUBLIB_cppunit CPPUNIT_SUBLIB_dl)
index b00b1b4216a4378ad49228bd934694d13445777a..ed481f9dfd82d967cbf40a324d0c5a7c335e43f5 100644 (file)
 #
 
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1)
-MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB)
+MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB HDF5_DIR)
+
+# Stupidly enough, CONFIG mode and MODULE mode for HDF5 do not return the same thing ...!
+SET(HDF5_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS};${HDF5_INCLUDE_DIR}")
+# Same story with libraries - if in CONFIG mode, HDF5_LIBRARIES is not defined:
+IF(NOT DEFINED HDF5_LIBRARIES)
+  SET(HDF5_LIBRARIES hdf5)
+ENDIF()
 
 ##
 ## 7. Specific to HDF5 only:
index 3aa6527e7cb6a6326da144b9a1efe26ade4f2b69..2d26445a94049cc50a1be995b63b97d1a18ea949 100644 (file)
 #
 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
 #
+# The caller of this macro might set SPHINX_PYTHONPATH to provide a path to be added in front 
+# of the PYTHONPATH with which the sphinx command should be ran.
+#
+# Note the environment is also overriden in 
+#     doc/docutils/CMakeLists.txt
+# with the creation of a dedicated launcher script.
+#
 
 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2)
+
+# Also retrieve paths to DOCUTILS and SETUPTOOLS:
+SET(SETUPTOOLS_ROOT_DIR "$ENV{SETUPTOOLS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+SET(DOCUTILS_ROOT_DIR "$ENV{DOCUTILS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+
+# Ensure the command is run with the given PYTHONPATH
+IF(WIN32 AND NOT CYGWIN)
+   MESSAGE(WARNING "Sphinx windows command not re-tested.")
+   SET(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE})
+ELSE()
+   SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$$PYTHONPATH" ${SPHINX_EXECUTABLE})
+ENDIF()
+
 MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
index ac0c954eea5ba4a6c10ba4846946e605652b72eb..8e05c7a73c21330b913c249bb7405651e6ffd72c 100644 (file)
@@ -1,6 +1,7 @@
 # - Sphinx detection
 #
 # Output variable: SPHINX_EXECUTABLE
+#                  
 # 
 # The executable 'sphinx-build' is looked for and returned in the above variable.
 #
index 34730369cbd675b516818aceaea54689aa6da52d..52c6a36ea7fdc752f61065d63c5a873ebbee86d3 100755 (executable)
@@ -205,8 +205,14 @@ ENDMACRO()
 # given when calling the command FIND_PACKAGE(SalomeXYZ). Those options are stored implicitly in 
 # CMake variables: xyz__FIND_QUIETLY, xyz_FIND_REQUIRED, etc ...
 # 
+# If a list of components was specified when invoking the initial FIND_PACKAGE(SalomeXyz ...) this is 
+# also handled properly.
+#
 # Modus is either MODULE or CONFIG (cf standard FIND_PACKAGE() documentation).
 # The last argument is optional and if set to TRUE will force the search to be OPTIONAL and QUIET.
+# If the package is looked for in CONFIG mode, the standard system paths are skipped. If you still want a 
+# system installation to be found in this mode, you have to set the ROOT_DIR variable explicitly to /usr (for
+# example). 
 #  
 # This macro is to be called from within the FindSalomeXXXX.cmake file.
 #
@@ -248,12 +254,12 @@ MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode)
         FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
               NO_MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS}
               PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files"
-              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH)
       ELSE()
         FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
               NO_MODULE ${_tmp_quiet} ${_tmp_req}
               PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files"
-              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH)
       ENDIF()
       MARK_AS_ADVANCED(${stdPkg}_DIR)
       
@@ -279,13 +285,12 @@ ENDMACRO()
 
 
 ####################################################################
-# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount <component1> <component2> ...)
+# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount)
 #    pkg              : name of the system package to be detected
 #    referenceVariable: variable containing a path that can be browsed up to 
 # retrieve the package root directory (xxx_ROOT_DIR)
 #    upCount          : number of times we have to go up from the path <referenceVariable>
 # to obtain the package root directory.
-#    <component_n>    : an optional list of components to be found.  
 #   
 # For example:  SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) 
 #
@@ -352,19 +357,36 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
   ENDIF()
 
   # Otherwise try the standard way (module mode, with the standard CMake Find*** macro):
-  SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE)
+  # We do it quietly to produce our own error message:
+  SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE TRUE)
   
   # Set the "FOUND" variable for the SALOME wrapper:
   IF(${pkg_UC}_FOUND OR ${pkg}_FOUND)
     SET(SALOME${pkg_UC}_FOUND TRUE)
   ELSE()
     SET(SALOME${pkg_UC}_FOUND FALSE)
+    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}")
+      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}")
+      ENDIF()
+    ENDIF()
   ENDIF()
   
   IF (${pkg_UC}_FOUND OR ${pkg}_FOUND)
     ## 3. Set the root dir which was finally retained by going up "upDir" times
     ## 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 ""))
+      MESSAGE(WARNING "${pkg}: the reference variable '${referenceVariable}' used when calling the macro "
+      "SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() does not exist or is empty.")
+    ENDIF()
+    
     LIST(LENGTH ${referenceVariable} _tmp_len)
     IF(_tmp_len)
        LIST(GET ${referenceVariable} 0 _tmp_ROOT_DIR)
@@ -425,3 +447,14 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
   SET(Salome${pkg}_FOUND "${pkg}_FOUND")
 ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS)
 
+
+####################################################################
+# SALOME_ADD_MPI_TO_HDF5()
+# 
+# Overload the HDF5 flags so that they also contain MPI references.
+# This is to be used when HDF5 was compiled with MPI support;
+MACRO(SALOME_ADD_MPI_TO_HDF5)  
+  SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_INCLUDE_DIRS})
+  SET(HDF5_DEFINITIONS "${HDF5_DEFINITIONS} ${MPI_DEFINITIONS}")
+  SET(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_LIBRARIES})
+ENDMACRO(SALOME_ADD_MPI_TO_HDF5)