From: =?utf-8?q?Timo_R=C3=B6hling?= <timo.roehling@fkie.fraunhofer.de>
Date: Sun, 5 Apr 2020 13:53:03 +0200
Subject: Add CMake configuration to examples

---
 examples/callback_api/CMakeLists.txt | 7 +++++++
 examples/callback_api/Makefile       | 2 --
 examples/callback_api/main.cc        | 3 +--
 examples/obj_sticher/CMakeLists.txt  | 7 +++++++
 examples/voxelize/CMakeLists.txt     | 7 +++++++
 examples/voxelize/Makefile           | 2 --
 examples/voxelize/main.cc            | 3 +--
 7 files changed, 23 insertions(+), 8 deletions(-)
 create mode 100644 examples/callback_api/CMakeLists.txt
 delete mode 100644 examples/callback_api/Makefile
 create mode 100644 examples/obj_sticher/CMakeLists.txt
 create mode 100644 examples/voxelize/CMakeLists.txt
 delete mode 100644 examples/voxelize/Makefile

diff --git a/examples/callback_api/CMakeLists.txt b/examples/callback_api/CMakeLists.txt
new file mode 100644
index 0000000..c43f452
--- /dev/null
+++ b/examples/callback_api/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(callback_api_example)
+
+find_package(tinyobjloader REQUIRED)
+
+add_executable(${PROJECT_NAME} main.cc)
+target_link_libraries(${PROJECT_NAME} tinyobjloader::tinyobjloader)
+
diff --git a/examples/callback_api/Makefile b/examples/callback_api/Makefile
deleted file mode 100644
index 45d60d8..0000000
--- a/examples/callback_api/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:
-	clang++ -I../../ -Wall -g -o example main.cc
diff --git a/examples/callback_api/main.cc b/examples/callback_api/main.cc
index 1911501..703a620 100644
--- a/examples/callback_api/main.cc
+++ b/examples/callback_api/main.cc
@@ -5,8 +5,7 @@
 // You need to implement your own Mesh data struct constrution based on this
 // example in practical.
 //
-#define TINYOBJLOADER_IMPLEMENTATION
-#include "tiny_obj_loader.h"
+#include <tiny_obj_loader.h>
 
 #include <cassert>
 #include <cstdio>
diff --git a/examples/obj_sticher/CMakeLists.txt b/examples/obj_sticher/CMakeLists.txt
new file mode 100644
index 0000000..10eaf97
--- /dev/null
+++ b/examples/obj_sticher/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(obj_sticher)
+
+find_package(tinyobjloader REQUIRED)
+
+add_executable(${PROJECT_NAME} obj_sticher.cc obj_writer.cc)
+target_link_libraries(${PROJECT_NAME} tinyobjloader::tinyobjloader)
+
diff --git a/examples/voxelize/CMakeLists.txt b/examples/voxelize/CMakeLists.txt
new file mode 100644
index 0000000..69ce0be
--- /dev/null
+++ b/examples/voxelize/CMakeLists.txt
@@ -0,0 +1,7 @@
+project(voxelize)
+
+find_package(tinyobjloader REQUIRED)
+
+add_executable(${PROJECT_NAME} main.cc)
+target_link_libraries(${PROJECT_NAME} tinyobjloader::tinyobjloader)
+
diff --git a/examples/voxelize/Makefile b/examples/voxelize/Makefile
deleted file mode 100644
index 98189d9..0000000
--- a/examples/voxelize/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:
-	g++ -o voxelizer main.cc
diff --git a/examples/voxelize/main.cc b/examples/voxelize/main.cc
index 6f11939..841b768 100644
--- a/examples/voxelize/main.cc
+++ b/examples/voxelize/main.cc
@@ -1,8 +1,7 @@
 #define VOXELIZER_IMPLEMENTATION
 #include "voxelizer.h"
 
-#define TINYOBJLOADER_IMPLEMENTATION
-#include "../../tiny_obj_loader.h"
+#include <tiny_obj_loader.h>
 
 bool Voxelize(const char* filename, float voxelsizex, float voxelsizey, float voxelsizez, float precision)
 {
