summaryrefslogtreecommitdiff
path: root/swig/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'swig/CMakeLists.txt')
-rw-r--r--swig/CMakeLists.txt47
1 files changed, 31 insertions, 16 deletions
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
index ea807f6..acf23f6 100644
--- a/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -8,22 +8,37 @@ ENABLE_TESTING()
SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" )
#
+# Allow to build only a subset of language bindings via options
+#
+
+OPTION(BUILD_RUBY_BINDINGS "Build Ruby bindings" ON)
+OPTION(BUILD_PYTHON2_BINDINGS "Build Python 2 bindings" ON)
+OPTION(BUILD_PERL5_BINDINGS "Build Perl 5 bindings" ON)
+
+#
# Let's see which target languages are available
#
-FIND_PACKAGE(Ruby)
-FIND_PACKAGE(PythonLibs)
-FIND_PACKAGE(Perl)
-
-
-IF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
- ADD_SUBDIRECTORY(ruby)
-ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
-
-IF (PYTHON_LIBRARY)
- ADD_SUBDIRECTORY(python)
-ENDIF(PYTHON_LIBRARY)
-
-#IF (PERL_EXECUTABLE)
-# ADD_SUBDIRECTORY(perl5)
-#ENDIF (PERL_EXECUTABLE)
+IF(BUILD_RUBY_BINDINGS)
+ FIND_PACKAGE(Ruby)
+ IF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
+ ADD_SUBDIRECTORY(ruby)
+ ENDIF()
+ENDIF()
+
+IF(BUILD_PYTHON2_BINDINGS)
+ # Enforce Python 2.7, libzypp-bindings does not yet work with Python3
+ set(PythonLibs_FIND_VERSION 2.7)
+ set(PythonLibs_FIND_VERSION_MAJOR 2)
+ FIND_PACKAGE(PythonLibs)
+ IF(PYTHON_LIBRARY)
+ ADD_SUBDIRECTORY(python)
+ ENDIF()
+ENDIF()
+
+#IF(BUILD_PERL5_BINDINGS)
+# FIND_PACKAGE(Perl)
+# IF(PERL_EXECUTABLE)
+# ADD_SUBDIRECTORY(perl5)
+# ENDIF()
+#ENDIF()