From 44a928cef6062a33624e63b76d43b6e9797bde80 Mon Sep 17 00:00:00 2001 From: bruneton Date: Tue, 30 Jul 2013 09:19:59 +0000 Subject: [PATCH] CMake: sync detection files with latest changes in KERNEL --- .../cmake_files/FindSalomeCppUnit.cmake | 2 +- .../cmake_files/FindSalomeHDF5.cmake | 9 +++- .../cmake_files/FindSalomeSphinx.cmake | 20 +++++++++ .../cmake_files/FindSphinx.cmake | 1 + .../cmake_files/SalomeMacros.cmake | 43 ++++++++++++++++--- 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake b/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake index fddffa311..cd3c5ce4b 100644 --- a/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake +++ b/adm_local_without_kernel/cmake_files/FindSalomeCppUnit.cmake @@ -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) diff --git a/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake b/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake index b00b1b421..ed481f9df 100644 --- a/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake +++ b/adm_local_without_kernel/cmake_files/FindSalomeHDF5.cmake @@ -28,7 +28,14 @@ # 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: diff --git a/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake b/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake index 3aa6527e7..2d26445a9 100644 --- a/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake +++ b/adm_local_without_kernel/cmake_files/FindSalomeSphinx.cmake @@ -21,6 +21,26 @@ # # !! 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) diff --git a/adm_local_without_kernel/cmake_files/FindSphinx.cmake b/adm_local_without_kernel/cmake_files/FindSphinx.cmake index ac0c954ee..8e05c7a73 100644 --- a/adm_local_without_kernel/cmake_files/FindSphinx.cmake +++ b/adm_local_without_kernel/cmake_files/FindSphinx.cmake @@ -1,6 +1,7 @@ # - Sphinx detection # # Output variable: SPHINX_EXECUTABLE +# # # The executable 'sphinx-build' is looked for and returned in the above variable. # diff --git a/adm_local_without_kernel/cmake_files/SalomeMacros.cmake b/adm_local_without_kernel/cmake_files/SalomeMacros.cmake index 34730369c..52c6a36ea 100755 --- a/adm_local_without_kernel/cmake_files/SalomeMacros.cmake +++ b/adm_local_without_kernel/cmake_files/SalomeMacros.cmake @@ -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 ...) +# 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 # to obtain the package root directory. -# : 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) -- 2.39.2