summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
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 /CMakeLists.txt
parent5bf34198f83cb2f00f34044c33c80cdf6a1e1985 (diff)
downloadlibical-git-4bbc31318bb97a7b32caf110f9c6d936ac81fa5c.tar.gz
CMakeLists.txt - turn-on C++ bindings only if a C++ compiler is found
part of issue#352
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 13 insertions, 5 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)