diff --git a/tribits/core/package_arch/TribitsPackageMacros.cmake b/tribits/core/package_arch/TribitsPackageMacros.cmake index 650cc780b..2886b2b95 100644 --- a/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -414,7 +414,7 @@ endmacro() # # Usage:: # -# tribits_disable_optional_dependency(upstreamPackageName reasonStr) +# tribits_disable_optional_dependency( "") # # This macro can be called from a top-level package's # ``/CMakeLists.txt`` file to disable an optional dependency that diff --git a/tribits/doc/guides/TribitsGuidesBody.rst b/tribits/doc/guides/TribitsGuidesBody.rst index 415972c3d..a196db14e 100644 --- a/tribits/doc/guides/TribitsGuidesBody.rst +++ b/tribits/doc/guides/TribitsGuidesBody.rst @@ -6474,19 +6474,16 @@ use a simple ``set()`` statement. Changing the value of a scope, but all other packages will see the old value of ``_ENABLE_``. To correctly change the value of one of these variables, instead use `dual_scope_set()`_ from the top-level -``/CMakeLists.txt`` file. And when changing the value of a -``_ENABLE_`` variable, one must also change the -value of the associated -`HAVE__`_ variable using -``dual_scope_set()`` as well. For example, to disable optional support for -```` in ```` in ```` -package's ``/CMakeLists.txt`` file, add the CMake code:: +``/CMakeLists.txt`` file. To perform this disable more robustly +than calling ``dual_scope_set()`` directly, use the provided macro +`tribits_disable_optional_dependency()`_. For example, to disable optional +support for ```` in ```` in +```` package's ``/CMakeLists.txt`` file based +on some criteria, add the CMake code:: if () - message("-- " "NOTE: ${PACKAGE_NAME}_ENABLE_ being set to OFF" - " because of " ) - dual_scope_set(${PACKAGE_NAME}_ENABLE_ OFF) - dual_scope_set(HAVE_${PACKAGE_NAME_UC}_ OFF) + tribits_disable_optional_dependency( + "NOTE: ${PACKAGE_NAME}_ENABLE_ being set to OFF because of " ) endif() Calling ``dual_scope_set()`` in the package's top-level @@ -6498,13 +6495,13 @@ scope. (But this does **not** change the value of a cache variable means which is the desired behavior; see `TriBITS auto-enables/disables done using non-cache local variables`_.) In this way, any downstream package (configured after processing ``/CMakeLists.txt``) will see the new -value for ``_ENABLE_`` (and its associated -``HAVE__`` variable). As shown above, it is also strongly -recommended that a message or warning be printed to CMake STDOUT using -``message("-- " "NOTE: ")`` when changing the value of one of these -``_ENABLE_`` variables. The user may have set it explicitly or -TriBITS may have printed automatic logic for setting it by default, and user -needs to know why and where the value is being overridden. +value for ``_ENABLE_``. + +It is also strongly recommended that a message be printed to CMake STDOUT +using ``message("-- " "NOTE: ")`` when changing the value of one of +these ``_ENABLE_`` variables. The user may have set it +explicitly or TriBITS may have printed automatic logic for setting it by +default, and user needs to know why and where the value is being overridden. **NOTE:** However, it is **not** allowed to try to change the value of a global enable of a upstream or downstream package by trying to change the diff --git a/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst b/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst index 532cc7cca..597e2cb2a 100644 --- a/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst +++ b/tribits/doc/guides/TribitsMacroFunctionDocTemplate.rst @@ -19,6 +19,7 @@ @FUNCTION: tribits_copy_files_to_binary_dir() + @FUNCTION: tribits_ctest_driver() + @FUNCTION: tribits_determine_if_current_package_needs_rebuilt() + +@MACRO: tribits_disable_optional_dependency() + @MACRO: tribits_disable_package_on_platforms() + @MACRO: tribits_exclude_files() + @MACRO: tribits_extpkg_define_dependencies() +