summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2018-08-21 10:16:22 -0400
committerAllen Winter <allen.winter@kdab.com>2018-08-21 10:16:22 -0400
commit4bbc31318bb97a7b32caf110f9c6d936ac81fa5c (patch)
tree64470e4c4fb367a682563bf9c5da364ad2a204d5
parent5bf34198f83cb2f00f34044c33c80cdf6a1e1985 (diff)
downloadlibical-git-4bbc31318bb97a7b32caf110f9c6d936ac81fa5c.tar.gz
CMakeLists.txt - turn-on C++ bindings only if a C++ compiler is found
part of issue#352
-rw-r--r--CMakeLists.txt18
-rw-r--r--Install.txt3
2 files changed, 15 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1cc7180e..5bcda64a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,7 @@
#
cmake_minimum_required(VERSION 3.1.0) #first line, to shutup a cygwin warning
-project(libical C CXX)
+project(libical C) #CXX is optional for the bindings
cmake_policy(SET CMP0003 NEW)
if(POLICY CMP0042)
@@ -538,14 +538,22 @@ endif()
########################################################
option(WITH_CXX_BINDINGS "Build the C++ bindings." True)
+if(WITH_CXX_BINDINGS)
+ if(CMAKE_CXX_COMPILER)
+ add_definitions(-DWITH_CXX_BINDINGS)
+ else()
+ message(STATUS
+ "Warning: Building the C++ bindings is not possible since a C++ compiler could not be found. "
+ "Turning-off C++ bindings"
+ )
+ set(WITH_CXX_BINDINGS False)
+ endif()
+endif()
add_feature_info(
"Option WITH_CXX_BINDINGS"
WITH_CXX_BINDINGS
- "build the C++ bindings"
+ "build the C++ bindings. Requires a C++ compiler"
)
-if(WITH_CXX_BINDINGS)
- add_definitions(-DWITH_CXX_BINDINGS)
-endif()
#some test programs need to know if we are using 32-bit time
if(SIZEOF_TIME_T EQUAL 4)
diff --git a/Install.txt b/Install.txt
index 1ba87063..71fedff1 100644
--- a/Install.txt
+++ b/Install.txt
@@ -103,8 +103,9 @@ For instance:
== Language Bindings ==
This C library can be built with bindings for these other languages:
-* C++. By default the buildsystem will create and install the C++ bindings API.
+* C++. If a C++ compiler is found the buildsystem will create and install the C++ bindings API.
Turn this off by passing -DWITH_CXX_BINDINGS=False option to CMake.
+ Don't mix ABI from C and C++ compilers.
* There are Java, Perl, PHP and Python bindings but they are old and haven't
been tested in a very long time. Volunteers wanted.