From 7abe72565b066fb1304853839247136f9ee4ebe0 Mon Sep 17 00:00:00 2001
From: Nikolaus Vahrenkamp <vahrenkamp@kit.edu>
Date: Thu, 24 Sep 2015 08:49:30 +0200
Subject: [PATCH] cmake setup: if qhull is not found, the internal version is
 chosen license: lgpl 2.1

---
 GraspPlanning/CMakeLists.txt                          | 11 +++++++++--
 .../ExternalDependencies/powercrust/CMakeLists.txt    |  2 +-
 .../ExternalDependencies/qhull-2003.1/CMakeLists.txt  |  1 +
 readme.txt                                            |  2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/GraspPlanning/CMakeLists.txt b/GraspPlanning/CMakeLists.txt
index 0fe1d33d1..cffe959c6 100644
--- a/GraspPlanning/CMakeLists.txt
+++ b/GraspPlanning/CMakeLists.txt
@@ -17,9 +17,16 @@ ENDMACRO(ADD_GRASPSTUDIO_TEST)
 
 ########### QHULL #################
 OPTION(BUILD_qhull "if on builds qhull external library" OFF)
+find_package(QHULL)
+IF (NOT QHULL_FOUND)
+	MESSAGE (STATUS "Could not find QHULL, building internal version simox-qhull")
+	SET (BUILD_qhull ON)
+	SET (BUILD_qhull ON PARENT_SCOPE)
+ENDIF()
+
 IF(BUILD_qhull)
-	ADD_SUBDIRECTORY(ExternalDependencies/qhull-2003.1)
-    set(QHULL_LIBRARIES simox-qhull)
+		ADD_SUBDIRECTORY(ExternalDependencies/qhull-2003.1)
+  	set(QHULL_LIBRARIES simox-qhull)
 else()
     find_package(QHULL REQUIRED)
     include_directories(${QHULL_INCLUDE_DIRS})
diff --git a/GraspPlanning/ExternalDependencies/powercrust/CMakeLists.txt b/GraspPlanning/ExternalDependencies/powercrust/CMakeLists.txt
index ef9dd1b45..e4885c79b 100644
--- a/GraspPlanning/ExternalDependencies/powercrust/CMakeLists.txt
+++ b/GraspPlanning/ExternalDependencies/powercrust/CMakeLists.txt
@@ -1,4 +1,3 @@
-
 PROJECT(powercrust)
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
@@ -14,6 +13,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include ${PROJEC
 ADD_LIBRARY(${PROJECT_NAME} STATIC ${SRCS} ${INCS})
 
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES FOLDER "3rd_Party")
+
 # .DLL path
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${Simox_BIN_DIR})
 # .so path
diff --git a/GraspPlanning/ExternalDependencies/qhull-2003.1/CMakeLists.txt b/GraspPlanning/ExternalDependencies/qhull-2003.1/CMakeLists.txt
index 1179e7b73..9408e57cc 100644
--- a/GraspPlanning/ExternalDependencies/qhull-2003.1/CMakeLists.txt
+++ b/GraspPlanning/ExternalDependencies/qhull-2003.1/CMakeLists.txt
@@ -2,6 +2,7 @@ PROJECT(simox-qhull)
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
 CMAKE_POLICY(VERSION 2.6)
+
 MESSAGE (STATUS " **** Configuring qhull")
 
 # Specify sources and headers
diff --git a/readme.txt b/readme.txt
index 442cd27fa..ff7451e39 100644
--- a/readme.txt
+++ b/readme.txt
@@ -34,7 +34,7 @@ support.
 
 License
 -------
-GNU Library General Public License, version 2 or any later version.
+GNU Library General Public License, version 2.1 or any later version.
 (see license.txt)
 
 Copyright
-- 
GitLab