From b21f707e5177bd5810339008469b72f07cfd2034 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Tue, 31 May 2011 13:53:36 +0200
Subject: [PATCH] Conditional build of Swig and Poliqarp

---
 CMakeLists.txt | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0c9c21..096fa86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,8 @@ IF(NOT CMAKE_BUILD_TYPE)
 		FORCE)
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
+set(CORPUS2_BUILD_SWIG True CACHE BOOL "Build SWIG Python wrappers" FORCE)
+set(CORPUS2_BUILD_POLIQARP True CACHE BOOL "Build Poliqarp library and wraper" FORCE)
 
 if(CMAKE_COMPILER_IS_GNUCXX)
 	# Set our own default flags at first run.
@@ -66,7 +68,23 @@ add_subdirectory(libpwrutils)
 add_subdirectory(libcorpus2)
 add_subdirectory(corpus2tools)
 add_subdirectory(tests)
-add_subdirectory(swig)
-add_subdirectory(poliqarp-library)
-add_subdirectory(poliqarp)
+
+if(CORPUS2_BUILD_POLIQARP)
+	add_subdirectory(poliqarp-library)
+	add_subdirectory(poliqarp)
+else()
+	message(STATUS "Not building Poliqarp library and wrapper")
+endif(CORPUS2_BUILD_POLIQARP)
+
+if(CORPUS2_BUILD_SWIG)
+	FIND_PACKAGE(SWIG)
+	if(SWIG_FOUND)
+		message(STATUS "SWIG found, Python wrappers will be built")
+		add_subdirectory(swig)
+	else()
+		message(STATUS "WARNING: SWIG not found, Python wrappers will not be built")
+	endif(SWIG_FOUND)
+else()
+	message(STATUS "Not building SWIG Python wrappers")
+endif(CORPUS2_BUILD_SWIG)
 
-- 
GitLab