Salome HOME
CMake: documenting SALOME_UPDATE_FLAG_AND_LOG_PACKAGE
authorbruneton <bruneton>
Tue, 27 Aug 2013 09:42:34 +0000 (09:42 +0000)
committerbruneton <bruneton>
Tue, 27 Aug 2013 09:42:34 +0000 (09:42 +0000)
dev/cmake/source/pkg.rst
dev/cmake/source/skeleton.rst

index d13a8ba7856b0e72fe59bd4c9aa419428def32e4..4b020b061612afd0e278af0e03659ea65e1721bc 100644 (file)
@@ -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<Xyz>.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.
index ba07f6c2af9275ce84279c6892198d07b22fdab9..dc4cf6aecd9edf90cd12250ecd0849117674bbbb 100644 (file)
@@ -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::