Background: while for autotools there are the ptx/endis, ptx/disen, and
ptx/wwo helpers, nothing comparable exists for cmake. For options
setting on cmake packages you can add those to FOO_CONF_OPT of your
package and currently there are for example those two ways:

ifdef PTXCONF_FOO_ENABLE_BAR
FOO_CONF_OPT += -DENABLE_BAR:BOOL=ON
else
FOO_CONF_OPT += -DENABLE_BAR:BOOL=OFF
endif

You could also use something shorter like:

FOO_CONF_OPT += -DENABLE_BAR=$(call ptx/ifdef, \
        PTXCONF_FOO_ENABLE_BAR, ON, OFF)

With the new helper macro this will be even easier:

FOO_CONF_OPT += -DENABLE_BAR=$(call ptx/onoff, PTXCONF_FOO_ENABLE_BAR)

Signed-off-by: Alexander Dahl <[email protected]>
---
 rules/pre/000-option-disabled.make | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/rules/pre/000-option-disabled.make 
b/rules/pre/000-option-disabled.make
index c252bff..6eaecf7 100644
--- a/rules/pre/000-option-disabled.make
+++ b/rules/pre/000-option-disabled.make
@@ -87,4 +87,16 @@ define ptx/wwo
 $(call ptx/ifdef, $(1), with, without)
 endef
 
+
+#
+# $(call ptx/onoff, PTXCONF_SYMBOL) returns "ON" or "OFF"
+# depending on the symbol is defined or not
+#
+# $(call ptx/onoff, PTXCONF_SYMBOL)
+#                     $1
+#
+define ptx/onoff
+$(call ptx/ifdef, $(1), ON, OFF)
+endef
+
 # vim: syntax=make
-- 
2.1.4


_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to