From c7a3f24f90c84187d18796009ced56d0fdef3f77 Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Mon, 18 Jan 2016 11:49:33 +0100
Subject: [PATCH] OGSFileConverter is now build as a library

---
 Applications/DataExplorer/DataExplorer.cmake  |  7 ++---
 .../Utils/OGSFileConverter/CMakeLists.txt     | 26 +++++++------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index a7b745094a5..da859c1c540 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -1,8 +1,6 @@
 # Source files
 set(SOURCES
 	mainwindow.cpp
-	${CMAKE_CURRENT_SOURCE_DIR}/../Utils/OGSFileConverter/OGSFileConverter.cpp
-	${CMAKE_CURRENT_SOURCE_DIR}/../Utils/OGSFileConverter/FileListDialog.cpp
 	${CMAKE_CURRENT_SOURCE_DIR}/Img/icons.qrc
 )
 
@@ -10,19 +8,21 @@ set(SOURCES
 # and include additional header
 set(SOURCE_DIR_REL ${CMAKE_CURRENT_SOURCE_DIR}/../..)
 include_directories(
+	${SOURCE_DIR_REL}/Applications/Utils/OGSFileConverter
 	${SOURCE_DIR_REL}/BaseLib
 	${SOURCE_DIR_REL}/MathLib
 	${SOURCE_DIR_REL}/GeoLib
 	${SOURCE_DIR_REL}/FileIO
 	${SOURCE_DIR_REL}/MeshLib
 	${SOURCE_DIR_REL}/MeshLibGEOTOOLS
+	${CMAKE_CURRENT_BINARY_DIR}/../Utils/OGSFileConverter
 	${CMAKE_CURRENT_BINARY_DIR}/Base
 	${CMAKE_CURRENT_BINARY_DIR}/DataView
 	${CMAKE_CURRENT_BINARY_DIR}/DataView/StratView
 	${CMAKE_CURRENT_BINARY_DIR}/DataView/DiagramView
 	${CMAKE_CURRENT_BINARY_DIR}/VtkVis
 	${CMAKE_CURRENT_BINARY_DIR}/VtkAct
-	${CMAKE_CURRENT_BINARY_DIR}/Applications/Utils/OGSFileConverter
+	${CMAKE_CURRENT_BINARY_DIR}
 	${CMAKE_CURRENT_SOURCE_DIR}/Base
 	${CMAKE_CURRENT_SOURCE_DIR}/DataView
 	${CMAKE_CURRENT_SOURCE_DIR}/DataView/StratView
@@ -59,6 +59,7 @@ target_link_libraries(DataExplorer
 	VtkVis
 	VtkAct
 	Threads::Threads
+	OGSFileConverterLib
 )
 
 if(CMAKE_CROSSCOMPILING)
diff --git a/Applications/Utils/OGSFileConverter/CMakeLists.txt b/Applications/Utils/OGSFileConverter/CMakeLists.txt
index 81f6521b09b..d4ea2ca9889 100644
--- a/Applications/Utils/OGSFileConverter/CMakeLists.txt
+++ b/Applications/Utils/OGSFileConverter/CMakeLists.txt
@@ -1,23 +1,21 @@
 # Specify minimum CMake version
-cmake_minimum_required(VERSION 2.8.3)
+cmake_minimum_required(VERSION 2.8.6)
 
 # Project name
 project(OGSFileConverter)
 
 cmake_policy(SET CMP0020 NEW)
 
+set(CMAKE_AUTOMOC TRUE)
+set(CMAKE_AUTOUIC TRUE)
+set(CMAKE_AUTORCC TRUE)
+
 # Source files
 set(SOURCES
 	FileListDialog.cpp
 	OGSFileConverter.cpp
 )
 
-# Moc Header files
-set(MOC_HEADERS
-	FileListDialog.h
-	OGSFileConverter.h
-)
-
 # UI files
 set(UIS
 	FileList.ui
@@ -27,11 +25,6 @@ set(UIS
 # Find installed Qt4 libraries and headers
 find_package(Qt4 QUIET REQUIRED)
 
-# Run Qts user interface compiler uic on .ui files
-qt4_wrap_ui(UI_HEADERS ${UIS})
-
-# Run Qts meta object compiler moc on header files
-qt4_wrap_cpp(MOC_SOURCES ${MOC_HEADERS})
 
 # Include the headers which are generated by uic and moc
 # and include additional header
@@ -50,17 +43,18 @@ include_directories(
 source_group("UI Files" REGULAR_EXPRESSION "\\w*\\.ui")
 source_group("Moc Files" REGULAR_EXPRESSION "moc_.*")
 
-# Create the library
-add_executable(OGSFileConverter
-	main.cpp
+add_library(OGSFileConverterLib
 	${SOURCES}
 	${HEADERS}
 	${MOC_HEADERS}
 	${MOC_SOURCES}
 	${UIS}
 )
+target_link_libraries(OGSFileConverterLib QtBase)
+
+add_executable(OGSFileConverter main.cpp)
 
-target_link_libraries(OGSFileConverter FileIO QtBase)
+target_link_libraries(OGSFileConverter OGSFileConverterLib FileIO QtBase)
 ADD_VTK_DEPENDENCY(OGSFileConverter)
 
 # Adds useful macros and variables
-- 
GitLab