summaryrefslogtreecommitdiffstats
path: root/package/flatcc/0001-CMakeLists.txt-conditionally-require-C-based-on-FLAT.patch
blob: 7d76d6caf1ffa4d9ad51afaeb9ac50ef9ff620ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 878d51187bbc1ad490b4cd15e3741bc0bd11b6b2 Mon Sep 17 00:00:00 2001
From: Joel Carlson <JoelsonCarl@gmail.com>
Date: Thu, 6 Sep 2018 14:53:20 -0600
Subject: [PATCH] CMakeLists.txt: conditionally require C++ based on
 FLATCC_TEST (#94)

C++ is only used when building the tests, so only include it as a
language via project() when FLATCC_TEST is enabled. This allows
toolchains that don't have C++ to build flatcc.

Signed-off-by: Joel Carlson <JoelsonCarl@gmail.com>
---
Upstream commit 878d51187bbc1ad490b4cd15e3741bc0bd11b6b2
---
 CMakeLists.txt | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b39a3d1..5df5161 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,18 @@
 #cmake_minimum_required (VERSION 2.8.11)
 cmake_minimum_required (VERSION 2.8)
 
-project (FlatCC C CXX)
+# Disable build of tests and samples. Due to custom build step
+# dependency on flatcc tool, some custom build configurations may
+# experience issues, and this option can then help.
+option(FLATCC_TEST "enable tests" ON)
+
+# Conditionally set project languages based on FLATCC_TEST, as C++ is
+# only necessary if building the tests.
+if (FLATCC_TEST)
+    project (FlatCC C CXX)
+else()
+    project (FlatCC C)
+endif()
 
 #
 # NOTE: when changing build options, clean the build using on of:
@@ -35,11 +46,6 @@ option(FLATCC_RTONLY "enable build of runtime library only" OFF)
 # cmake -DBUILD_SHARED_LIBS=on can override.
 option(FLATCC_INSTALL "enable build of runtime library only" OFF)
 
-# Disable build of tests and samples. Due to custom build step
-# dependency on flatcc tool, some custom build configurations may
-# experience issues, and this option can then help.
-option(FLATCC_TEST "enable tests" ON)
-
 # Use with debug build with testing enabled only. Enables generation
 # of coverage information during build and run. Adds target "coverage"
 # which collects data and makes HTML report in build directory
-- 
2.7.4

OpenPOWER on IntegriCloud