1 From 40a4871b171293d98acb40cf54be9ee9b78a3244 Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Wed, 6 Jun 2012 00:49:25 +0200
4 Subject: [PATCH 1/1] build systems: make example build optional
6 This patch makes example build optional for both cmake and autotools build
9 In order to keep the former behavior, example build is enabled by default.
11 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
13 diff -Nurp a/CMakeLists.txt b/CMakeLists.txt
14 --- a/CMakeLists.txt 2013-12-08 18:51:01.000000000 +0000
15 +++ b/CMakeLists.txt 2014-01-08 12:51:42.435096403 +0000
16 @@ -39,6 +39,7 @@ IF(LIBNFC_ENVVARS)
17 ADD_DEFINITIONS(-DENVVARS)
20 +SET(BUILD_EXAMPLES ON CACHE BOOL "Build examples")
21 SET(LIBNFC_DEBUG_MODE OFF CACHE BOOL "Debug mode")
23 ADD_DEFINITIONS(-DDEBUG)
24 @@ -155,7 +156,10 @@ ENDIF(WIN32)
25 ADD_SUBDIRECTORY(libnfc)
26 ADD_SUBDIRECTORY(include)
27 ADD_SUBDIRECTORY(utils)
28 -ADD_SUBDIRECTORY(examples)
31 + ADD_SUBDIRECTORY(examples)
32 +ENDIF(BUILD_EXAMPLES)
36 diff -Nurp a/Makefile.am b/Makefile.am
37 --- a/Makefile.am 2013-12-08 18:51:01.000000000 +0000
38 +++ b/Makefile.am 2014-01-08 12:52:12.807018593 +0000
39 @@ -2,7 +2,13 @@ ACLOCAL_AMFLAGS = -I m4
41 AM_CFLAGS = $(LIBNFC_CFLAGS)
43 -SUBDIRS = libnfc utils examples include contrib cmake test
44 +SUBDIRS = libnfc utils
50 +SUBDIRS += include contrib cmake test
52 pkgconfigdir = $(libdir)/pkgconfig
53 pkgconfig_DATA = libnfc.pc
54 diff -Nurp a/configure.ac b/configure.ac
55 --- a/configure.ac 2013-12-08 18:51:01.000000000 +0000
56 +++ b/configure.ac 2014-01-08 12:53:02.054872564 +0000
57 @@ -142,6 +142,14 @@ then
59 AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
61 +# Example build (default: yes)
62 +AC_ARG_ENABLE([example],AS_HELP_STRING([--enable-example],[Enable example build.]),[enable_example=$enableval],[enable_example="yes"])
64 +AC_MSG_CHECKING(for example build)
65 +AC_MSG_RESULT($enable_example)
67 +AM_CONDITIONAL(EXAMPLE_ENABLED, [test x"$enable_example" = xyes])
70 PKG_CONFIG_REQUIRES=""
72 @@ -160,7 +168,10 @@ if test x$ac_cv_with_cutter = xyes -a x$
74 AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])
76 +if test x"$enable_example" = "xyes"
81 # Help us to write great code ;-)
82 CFLAGS="$CFLAGS -Wall -pedantic -Wextra"