From: Alexander Dahl <post@lespocky.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] add helper macro for simpler cmake options setting
Date: Fri, 6 Nov 2015 10:10:27 +0100 [thread overview]
Message-ID: <1446801027-25717-1-git-send-email-post@lespocky.de> (raw)
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 <post@lespocky.de>
---
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
ptxdist@pengutronix.de
reply other threads:[~2015-11-06 9:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446801027-25717-1-git-send-email-post@lespocky.de \
--to=post@lespocky.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox