From 8dd264e10c52d3d01620f8fa76a287118b3a78ef Mon Sep 17 00:00:00 2001
From: Stefan Bienert <stefan.bienert@unibas.ch>
Date: Tue, 24 Mar 2015 17:25:58 +0100
Subject: [PATCH] More CMake documentation
---
actions/CMakeLists.txt | 4 ++--
cmake_support/doc/index.rst | 33 ++++++++++++++++++++++++++++++---
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/actions/CMakeLists.txt b/actions/CMakeLists.txt
index d5666f1d..90f98aa6 100644
--- a/actions/CMakeLists.txt
+++ b/actions/CMakeLists.txt
@@ -1,6 +1,6 @@
add_custom_target(actions ALL)
+add_subdirectory(tests)
+
pm_action_init()
pm_action(pm-build-rawmodel actions)
pm_action(pm-help actions)
-
-add_subdirectory(tests)
diff --git a/cmake_support/doc/index.rst b/cmake_support/doc/index.rst
index cc3b7023..368f4b1c 100644
--- a/cmake_support/doc/index.rst
+++ b/cmake_support/doc/index.rst
@@ -26,7 +26,7 @@ into three categories of varying relevance for you:
Best practices for using our home-brew |cmake| functions are found in the
various :file:`CMakeLists.txt` files in the project's directory tree.
-Functions For Module Maintenance
+Functions For Module/ Action Maintenance
--------------------------------------------------------------------------------
Unit Tests
@@ -54,7 +54,8 @@ Unit Tests
``MODULE``
Specify the name of the module these tests are made for. Needs to be set,
- needs to be a single word.
+ needs to be a single word. Ends up in ``make help`` as a prefix, nothing
+ will break if it does not match the name of any existing module.
``Sources``
Describe a set of files hosting unit test code here. If its a wild mix of
@@ -80,10 +81,36 @@ Unit Tests
``TARGET``
This defines an additional dependency for the unit test.
+Actions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. cmake:command:: pm_action
+
+ .. code-block:: cmake
+
+ pm_action(ACTION action-script
+ TARGET target)
+
+ Add an action to |project|. Actions are scripts called by the ``pm`` launcher
+ and should all live in the :file:`actions` directory as executable files.
+ Adding an action means connecting its file with the given target to be copied
+ to the :file:`libexec` directory. No dedicated ``make`` target will be
+ created.
+
+ The parameters are:
+
+ ``ACTION``
+ Name of the action to be added. Should start with ``pm-``. Needs to be an
+ existing file in the same directory as the invoking :file:`CMakeLists.txt`.
+
+ ``TARGET``
+ Provide a ``make`` target to trigger copying the action's script file. The
+ target has to be created **before** any action may be attached to it.
+
.. Finding packages
.. -----------------
.. Extending |cmake|
.. -----------------
-.. LocalWords: cmake PROMOD
+.. LocalWords: cmake PROMOD CMakeLists txt promod unittest codetest xml py
+.. LocalWords: libexec
--
GitLab