From b36c1df0ed070b356266412b436e4295062aeb07 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 23 Mar 2016 17:14:01 +0100
Subject: [PATCH] Use conan shapelib package.

---
 .gitignore                                           | 4 ++++
 Applications/DataExplorer/DataExplorer.cmake         | 8 +++-----
 Applications/Utils/FileConverter/ConvertSHPToGLI.cpp | 2 +-
 CMakeLists.txt                                       | 3 +++
 FileIO/CMakeLists.txt                                | 2 +-
 FileIO/SHPInterface.h                                | 2 +-
 ThirdParty/CMakeLists.txt                            | 2 --
 conanfile.txt                                        | 5 +++++
 8 files changed, 18 insertions(+), 10 deletions(-)
 create mode 100644 conanfile.txt

diff --git a/.gitignore b/.gitignore
index e73b44c2a0c..054d05d15ea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,7 @@ tags
 .idea/tasks.xml
 .idea/dictionaries
 .idea/modules.xml
+
+# Conan package manager
+conanbuildinfo.cmake
+conaninfo.txt
diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index d04db7140d0..cc7dbf79bc2 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -73,13 +73,11 @@ endif()
 
 if(VTK_NETCDF_FOUND)
 	target_link_libraries(DataExplorer vtkNetCDF vtkNetCDF_cxx )
-else()
-	target_link_libraries(DataExplorer ${Shapelib_LIBRARIES} )
-endif () # Shapelib_FOUND
+endif()
 
-if (GEOTIFF_FOUND)
+if(GEOTIFF_FOUND)
 	target_link_libraries(DataExplorer ${GEOTIFF_LIBRARIES} )
-endif () # GEOTIFF_FOUND
+endif()
 
 add_dependencies (DataExplorer VtkVis)
 
diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
index fc8057ee17b..1daacdf9a3a 100644
--- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
+++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
@@ -24,7 +24,7 @@
 #include "logog/include/logog.hpp"
 
 // ShapeLib
-#include "shape/shapefil.h"
+#include <shapefil.h>
 
 // BaseLib
 #include "LogogSimpleFormatter.h"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3ac9ed7619..dba02ede5a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,9 @@ set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, defaults
 option(OGS_BUILD_TESTS "Should the test executables be built?" ON)
 
 ### CMake includes ###
+include(conanbuildinfo.cmake)
+conan_basic_setup()
+
 include(scripts/cmake/CheckTypeSizes.cmake)
 include(scripts/cmake/Functions.cmake)
 include(scripts/cmake/CMakeSetup.cmake)
diff --git a/FileIO/CMakeLists.txt b/FileIO/CMakeLists.txt
index 9ebfdfb669c..42e8b7841a6 100644
--- a/FileIO/CMakeLists.txt
+++ b/FileIO/CMakeLists.txt
@@ -59,7 +59,7 @@ target_link_libraries(FileIO INTERFACE
 	InSituLib
 	MeshLib
 	logog
-	shp
+	${CONAN_LIBS}
 )
 if(QT4_FOUND)
 	target_link_libraries(FileIO PUBLIC Qt4::QtXml Qt4::QtXmlPatterns)
diff --git a/FileIO/SHPInterface.h b/FileIO/SHPInterface.h
index b29a881832e..241809c416e 100644
--- a/FileIO/SHPInterface.h
+++ b/FileIO/SHPInterface.h
@@ -22,7 +22,7 @@
 #include <vector>
 
 //ShapeLib includes
-#include "shape/shapefil.h"
+#include <shapefil.h>
 
 
 namespace GeoLib {
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index f28670b9751..49f7aa5ea6a 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -16,8 +16,6 @@ set_target_properties(test-logog PROPERTIES EXCLUDE_FROM_ALL TRUE)
 
 add_subdirectory(gtest)
 
-add_subdirectory(shape)
-
 # This is a workaround for Travis builds.
 option(OGS_USE_OPTIONAL_SUBMODULES "Option for enabling optional submodules" OFF)
 
diff --git a/conanfile.txt b/conanfile.txt
new file mode 100644
index 00000000000..fead82e93b9
--- /dev/null
+++ b/conanfile.txt
@@ -0,0 +1,5 @@
+[requires]
+Shapelib/1.3.0@bilke/stable
+
+[generators]
+cmake
-- 
GitLab