From: bruneton Date: Tue, 27 Aug 2013 09:42:34 +0000 (+0000) Subject: CMake: documenting SALOME_UPDATE_FLAG_AND_LOG_PACKAGE X-Git-Tag: V7_4_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7779bc76dda6f99e1b627cdacd139cc78d7ba1f8;p=tools%2Fdocumentation.git CMake: documenting SALOME_UPDATE_FLAG_AND_LOG_PACKAGE --- diff --git a/dev/cmake/source/pkg.rst b/dev/cmake/source/pkg.rst index d13a8ba..4b020b0 100644 --- a/dev/cmake/source/pkg.rst +++ b/dev/cmake/source/pkg.rst @@ -42,7 +42,7 @@ The order of priority for the detection of a package is (from high to low priori CMake has two possible modes of detection, CONFIG mode and MODULE mode. The order of priority is explicitly set in SALOME to: -1. CONFIG (also called NO_MODULE) mode: this tries to load a xyz-config.cmake file from the package installation itself +1. CONFIG (also called NO_MODULE) mode: this tries to load a xyz-config.cmake file from the package installation itself. Note that by default, this mode doesn't look at a potential system installation. If you do want the CONFIG mode to also inspect your system, you have to explicitly set the XYZ_ROOT_DIR variable to your system's path (typically "/usr"). 2. MODULE mode: this relies on the logic written in a FindXyz.cmake macro, looking directly for representative libraries, binaries or headers of the package. The first mode is preferred as it allows to directly include the CMake targets of the prerequisite. @@ -68,6 +68,13 @@ All prerequisite detection in SALOME should be implemented by: FIND_PACKAGE(SalomeLibXml2 REQUIRED) +* potentially, a prerequisite might be optional. In this case the following syntax is preferred:: + + FIND_PACKAGE(SalomeLibXml2) + SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(LibXml2 SALOME_FOO_FEATURE) + +* the custom macro SALOME_UPDATE_FLAG_AND_LOG_PACKAGE takes care of switching OFF the flag SALOME_FOO_FEATURE if the package was not found. The final status of what has been found or not can then be displayed by calling SALOME_PACKAGE_REPORT(). + Typically the FindSalome.cmake file looks like this:: SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CppUnit CPPUNIT_INCLUDE_DIRS 1) @@ -82,7 +89,8 @@ It invokes the SALOME macro SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() which tak In the example above, -* we look for the package CppUnit (note that this is case-sensitive). There is already a standard CMake module to detect CppUnit, which sets the CMake variable CPPUNIT_INCLUDE_DIRS to the (list of) directories to include when compiling with CppUnit. Going one level up from the include directory (typically /usr/include) gives the root directory of the installation (/usr). +* we look for the package CppUnit (note that this is case-sensitive). There is already a standard CMake module to detect CppUnit, which sets the CMake variable CPPUNIT_INCLUDE_DIRS to the (list of) directories to include when compiling with CppUnit. +* going one level up from the include directory (typically /usr/include) gives the root directory of the installation (/usr). * all the variables exposed in the cache by the standard detection logic (CPPUNIT_INCLUDE_DIRS, CPPUNIT_LIBRARIES, etc ...) are marked as "advanced" so that they do not automatically appear in ccmake or cmake-gui. Note that the reference variable may be a list, only its first element is then considered. diff --git a/dev/cmake/source/skeleton.rst b/dev/cmake/source/skeleton.rst index ba07f6c..dc4cf6a 100644 --- a/dev/cmake/source/skeleton.rst +++ b/dev/cmake/source/skeleton.rst @@ -25,12 +25,21 @@ The root CMakeLists.txt should contain the following elements: FIND_PACKAGE(SalomeSWIG REQUIRED) -* Detection of the optional prerequisites (potentially conditioned on some user options):: +* Detection of the optional prerequisites (potentially conditioned on some user options - see :ref:`package` for more on this):: - IF(NOT SALOME_LIGHT_ONLY) - FIND_PACKAGE(SalomeOmniORB REQUIRED) - FIND_PACKAGE(SalomeOmniORBPy REQUIRED) - ENDIF() + IF(SALOME_BUILD_DOC) + FIND_PACKAGE(SalomeDoxygen) + FIND_PACKAGE(SalomeGraphviz) + FIND_PACKAGE(SalomeSphinx) + SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Doxygen SALOME_BUILD_DOC) + SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Graphviz SALOME_BUILD_DOC) + SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Sphinx SALOME_BUILD_DOC) + ENDIF(SALOME_BUILD_DOC) + + +* Printing a report about the detection status:: + + SALOME_PACKAGE_REPORT() * Common installation directories. Those directories should be used consistently across all SALOME modules::