From 49c54c7cce170f24ceb4c98b559d8cfe359a1610 Mon Sep 17 00:00:00 2001
From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
Date: Thu, 12 Mar 2020 11:52:04 +0100
Subject: [PATCH] Updated the project's build configuration to be in sync with
 the other GeoModel projects.

This included moving all the common configuration options into the
project configuration file, exporting all components in the
"GeoModelTools::" namespace, setting up a semi-proper CPack
configuration for the project, and cleaning the configuration
as much as possible.
---
 CMakeLists.txt                     |  64 +++++++--
 ExpressionEvaluator/CMakeLists.txt |  65 ++++------
 GMCAT/CMakeLists.txt               |  47 +++----
 JSONParser/CMakeLists.txt          |  58 ++++-----
 LICENSE                            | 201 +++++++++++++++++++++++++++++
 XMLParser/CMakeLists.txt           |  65 +++-------
 cmake/FindEigen3.cmake             |  99 ++++++++++++++
 cmake/GeoModelToolsConfig.cmake    |   5 -
 cmake/GeoModelToolsConfig.cmake.in |  24 ++++
 cmake/GeoModelToolsPackaging.cmake |  34 +++++
 10 files changed, 498 insertions(+), 164 deletions(-)
 create mode 100644 LICENSE
 create mode 100644 cmake/FindEigen3.cmake
 delete mode 100644 cmake/GeoModelToolsConfig.cmake
 create mode 100644 cmake/GeoModelToolsConfig.cmake.in
 create mode 100644 cmake/GeoModelToolsPackaging.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b818224..8c38a41 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,15 +1,61 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Set up the project.
 cmake_minimum_required( VERSION 3.1 )
-project( "GeoModelTools" VERSION 1.0.0 LANGUAGES CXX )
+project( "GeoModelTools" VERSION 3.1.2 LANGUAGES CXX )
+
+# Set default build options.
+set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
+set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" )
+set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
+
+# Make the module directory visible to CMake.
+list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
+
+# Use the GNU install directory names.
+include( GNUInstallDirs )
+
+# Find the externals needed by the project.
+find_package( GeoModelCore REQUIRED )
+find_package( GeoModelIO REQUIRED )
+find_package( nlohmann_json )
+find_package( XercesC REQUIRED )
+find_package( Eigen3 )
+
+# Set up the build of the libraries of the project.
+add_subdirectory( XMLParser )
+add_subdirectory( JSONParser )
+add_subdirectory( ExpressionEvaluator )
+add_subdirectory( GMCAT )
 
-add_subdirectory(XMLParser)
-add_subdirectory(JSONParser)
-add_subdirectory(ExpressionEvaluator)
-add_subdirectory(GMCAT)
+# Create and install the version description of the project.
+include( WriteBasicConfigVersionFile )
+write_basic_config_version_file(
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake
+   VERSION ${PROJECT_VERSION}
+   COMPATIBILITY SameMajorVersion )
+install(
+   FILES
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}ConfigVersion.cmake
+   COMPONENT Development
+   DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} )
 
-install(EXPORT JSONParser-export FILE GeoModelTools-JSONParser.cmake DESTINATION lib/cmake/GeoModelTools)
-install(EXPORT XMLParser-export FILE GeoModelTools-XMLParser.cmake DESTINATION lib/cmake/GeoModelTools)
-install(EXPORT ExpressionEvaluator-export FILE GeoModelTools-ExpressionEvaluator.cmake DESTINATION lib/cmake/GeoModelTools)
+# Create and install the description of the libraries.
+install( EXPORT ${PROJECT_NAME}-export
+   FILE ${PROJECT_NAME}Targets.cmake
+   COMPONENT Development
+   NAMESPACE "${PROJECT_NAME}::"
+   DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} )
 
-install(FILES cmake/GeoModelToolsConfig.cmake DESTINATION lib/cmake/GeoModelTools)
+# Install the hand-written project configuration.
+configure_file( ${CMAKE_SOURCE_DIR}/cmake/GeoModelToolsConfig.cmake.in
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake
+   @ONLY )
+install(
+   FILES
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake
+   COMPONENT Development
+   DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} )
 
+# Set up the packaging of the project using CPack.
+include( GeoModelToolsPackaging )
diff --git a/ExpressionEvaluator/CMakeLists.txt b/ExpressionEvaluator/CMakeLists.txt
index 2e8c273..e5e882f 100644
--- a/ExpressionEvaluator/CMakeLists.txt
+++ b/ExpressionEvaluator/CMakeLists.txt
@@ -1,17 +1,4 @@
-cmake_minimum_required( VERSION 3.1 )
-
-# Set up the project.
-project( "ExpressionEvaluator" VERSION 1.0.0 LANGUAGES CXX )
-
-# Set default build options.
-set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
-set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" )
-set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
-
-# Use the GNU install directory names.
-include( GNUInstallDirs )
-
-find_package( GeoModelCore REQUIRED )
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Find the header and source files.
 file( GLOB SOURCES src/*.cxx )
@@ -19,36 +6,28 @@ file( GLOB HEADERS ExpressionEvaluator/*.h )
 
 # Create the library.
 add_library( ExpressionEvaluator SHARED ${HEADERS} ${SOURCES} )
-set_property( TARGET ExpressionEvaluator
-   PROPERTY PUBLIC_HEADER ${HEADERS} )
-target_link_libraries( ExpressionEvaluator PUBLIC GeoModelCore::GeoModelKernel  )
-target_include_directories( ExpressionEvaluator SYSTEM PUBLIC  )
+target_link_libraries( ExpressionEvaluator PRIVATE
+   GeoModelCore::GeoModelKernel )
 target_include_directories( ExpressionEvaluator PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-   $<INSTALL_INTERFACE:include> )
+   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> )
 source_group( "ExpressionEvaluator" FILES ${HEADERS} )
 source_group( "src" FILES ${SOURCES} )
-
-# # Install the library.
-# install( TARGETS ExpressionEvaluator
-#    EXPORT ExpressionEvaluator
-#    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-#    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator )
-
-# Install a CMake description of the project/library.
-# install( EXPORT ExpressionEvaluator DESTINATION cmake )
-
-
-# new test GeoModelCore
-install( TARGETS ExpressionEvaluator EXPORT ExpressionEvaluator-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator )
-#
-# Version the shared library. (Please update when cutting a new release!)
-#
-set(MYLIB_VERSION_MAJOR 1)
-set(MYLIB_VERSION_MINOR 1)
-set(MYLIB_VERSION_PATCH 0)
-set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH})
-
-set_target_properties(ExpressionEvaluator PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR})
-
+set_target_properties( ExpressionEvaluator PROPERTIES
+   VERSION ${PROJECT_VERSION}
+   SOVERSION ${PROJECT_VERSION_MAJOR} )
+
+# Install the library.
+install( TARGETS ExpressionEvaluator
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Runtime
+   NAMELINK_SKIP )
+install( TARGETS ExpressionEvaluator
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Development
+   NAMELINK_ONLY )
+install( FILES ${HEADERS}
+   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ExpressionEvaluator
+   COMPONENT Development )
diff --git a/GMCAT/CMakeLists.txt b/GMCAT/CMakeLists.txt
index 67fb628..392472e 100644
--- a/GMCAT/CMakeLists.txt
+++ b/GMCAT/CMakeLists.txt
@@ -1,27 +1,20 @@
-
-set(MYLIB_VERSION_MAJOR 1)
-set(MYLIB_VERSION_MINOR 0)
-set(MYLIB_VERSION_PATCH 0)
-
-set( CMAKE_BUILD_TYPE DEBUG )
-set(CMAKE_CXX_FLAGS "-fPIC -O0 -g -gdwarf-2" )
-
-project ( "gmcat" VERSION ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH} LANGUAGES CXX )
-
-find_package( GeoModelCore REQUIRED )
-find_package( GeoModelIO REQUIRED )
-find_package( Eigen3 REQUIRED )
-file( GLOB SOURCES src/*.cxx )
-
-include_directories ("${PROJECT_SOURCE_DIR}")
-include_directories ("${PROJECT_SOURCE_DIR}/src")
-add_executable ( gmcat ${SOURCES} ${HEADERS}  )
-
-# External dependencies:
-
-target_link_libraries (gmcat GeoModelCore::GeoModelKernel GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite )
-install(TARGETS gmcat DESTINATION bin)
-
-
-
-
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+# Declare the package's executable.
+add_executable( gmcat src/gmcat.cxx )
+target_link_libraries( gmcat PRIVATE GeoModelCore::GeoModelKernel
+   GeoModelIO::GeoModelRead GeoModelIO::GeoModelWrite
+   GeoModelIO::GeoModelDBManager )
+
+# Tweak how debug information should be attached to the executable, in Debug
+# builds.
+if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND
+   "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" )
+   target_compile_options( gmcat PRIVATE "-gdwarf-2" )
+endif()
+
+# Install the executable.
+install( TARGETS gmcat
+   EXPORT ${PROJECT_NAME}-export
+   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+   COMPONENT Runtime )
diff --git a/JSONParser/CMakeLists.txt b/JSONParser/CMakeLists.txt
index b9ba6e2..a393ea1 100644
--- a/JSONParser/CMakeLists.txt
+++ b/JSONParser/CMakeLists.txt
@@ -1,20 +1,4 @@
-cmake_minimum_required( VERSION 3.1 )
-
-# Set up the project.
-project( "JSONParser" VERSION 1.0.0 LANGUAGES CXX )
-
-find_package( GeoModelCore  REQUIRED )
-find_package( nlohmann_json QUIET )
-find_package( Eigen3 REQUIRED )
-
-
-# Set default build options.
-set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
-set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" )
-set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
-
-# Use the GNU install directory names.
-include( GNUInstallDirs )
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Find the header and source files.
 file( GLOB SOURCES src/*.cxx )
@@ -22,29 +6,31 @@ file( GLOB HEADERS JSONParser/*.h )
 
 # Create the library.
 add_library( JSONParser SHARED ${HEADERS} ${SOURCES} )
-set_property( TARGET JSONParser
-   PROPERTY PUBLIC_HEADER ${HEADERS} )
 if( nlohmann_json_FOUND )
-  target_link_libraries( JSONParser PUBLIC nlohmann_json::nlohmann_json GeoModelCore::GeoModelKernel )
+   target_link_libraries( JSONParser PUBLIC nlohmann_json::nlohmann_json )
 else()
-  message(STATUS "'nlohmann_json' not found by CMake!! Anyway, if you installed the single header file in a standard system include dir, I will be able to use it.")
-  target_link_libraries( JSONParser PUBLIC GeoModelCore::GeoModelKernel )
+   message( WARNING "'nlohmann_json' not found by CMake! The build may fail." )
 endif()
-target_include_directories( JSONParser SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} )
 target_include_directories( JSONParser PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-   $<INSTALL_INTERFACE:include> )
+   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> )
 source_group( "JSONParser" FILES ${HEADERS} )
 source_group( "src" FILES ${SOURCES} )
-
-install( TARGETS JSONParser EXPORT JSONParser-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/JSONParser )
-#
-# Version the shared library. (Please update when cutting a new release!)
-#
-set(MYLIB_VERSION_MAJOR 1)
-set(MYLIB_VERSION_MINOR 1)
-set(MYLIB_VERSION_PATCH 0)
-set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH})
-
-set_target_properties(JSONParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR})
+set_target_properties( JSONParser PROPERTIES
+   VERSION ${PROJECT_VERSION}
+   SOVERSION ${PROJECT_VERSION_MAJOR} )
+
+# Install the library.
+install( TARGETS JSONParser
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Runtime
+   NAMELINK_SKIP )
+install( TARGETS JSONParser
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Development
+   NAMELINK_ONLY )
+install( FILES ${HEADERS}
+   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/JSONParser
+   COMPONENT Development )
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..c8f313a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2019 GeoModelDev
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/XMLParser/CMakeLists.txt b/XMLParser/CMakeLists.txt
index b6f28d2..a52cd3a 100644
--- a/XMLParser/CMakeLists.txt
+++ b/XMLParser/CMakeLists.txt
@@ -1,19 +1,4 @@
-cmake_minimum_required( VERSION 3.1 )
-
-# Set up the project.
-project( "XMLParser" VERSION 1.0.0 LANGUAGES CXX )
-
-find_package( GeoModelCore REQUIRED )
-find_package( XercesC REQUIRED )
-
-
-# Set default build options.
-set( CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build mode to use" )
-set( CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for the build" )
-set( CMAKE_CXX_EXTENSIONS FALSE CACHE BOOL "(Dis)allow using GNU extensions" )
-
-# Use the GNU install directory names.
-include( GNUInstallDirs )
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Find the header and source files.
 file( GLOB SOURCES src/*.cxx )
@@ -21,36 +6,28 @@ file( GLOB HEADERS XMLParser/*.h )
 
 # Create the library.
 add_library( XMLParser SHARED ${HEADERS} ${SOURCES} )
-set_property( TARGET XMLParser
-   PROPERTY PUBLIC_HEADER ${HEADERS} )
-target_link_libraries( XMLParser PUBLIC ExpressionEvaluator XercesC::XercesC GeoModelCore::GeoModelKernel )
+target_link_libraries( XMLParser PUBLIC XercesC::XercesC ExpressionEvaluator )
 target_include_directories( XMLParser SYSTEM PUBLIC )
 target_include_directories( XMLParser PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-   $<INSTALL_INTERFACE:include> )
+   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> )
 source_group( "XMLParser" FILES ${HEADERS} )
 source_group( "src" FILES ${SOURCES} )
-
-# # Install the library.
-# install( TARGETS XMLParser
-#    EXPORT XMLParser
-#    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-#    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XMLParser )
-
-# Install a CMake description of the project/library.
-# install( EXPORT XMLParser DESTINATION cmake )
-
-
-# new test GeoModelCore
-install( TARGETS XMLParser EXPORT XMLParser-export LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XMLParser )
-#
-# Version the shared library. (Please update when cutting a new release!)
-#
-set(MYLIB_VERSION_MAJOR 1)
-set(MYLIB_VERSION_MINOR 1)
-set(MYLIB_VERSION_PATCH 0)
-set(MYLIB_VERSION_STRING ${MYLIB_VERSION_MAJOR}.${MYLIB_VERSION_MINOR}.${MYLIB_VERSION_PATCH})
-
-set_target_properties(XMLParser PROPERTIES VERSION ${MYLIB_VERSION_STRING} SOVERSION ${MYLIB_VERSION_MAJOR})
-
+set_target_properties( XMLParser PROPERTIES
+   VERSION ${PROJECT_VERSION}
+   SOVERSION ${PROJECT_VERSION_MAJOR} )
+
+# Install the library.
+install( TARGETS XMLParser
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Runtime
+   NAMELINK_SKIP )
+install( TARGETS XMLParser
+   EXPORT ${PROJECT_NAME}-export
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+   COMPONENT Development
+   NAMELINK_ONLY )
+install( FILES ${HEADERS}
+   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/XMLParser
+   COMPONENT Development )
diff --git a/cmake/FindEigen3.cmake b/cmake/FindEigen3.cmake
new file mode 100644
index 0000000..e4d48ae
--- /dev/null
+++ b/cmake/FindEigen3.cmake
@@ -0,0 +1,99 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+#   find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+#  EIGEN3_FOUND - system has eigen lib with correct version
+#  EIGEN3_INCLUDE_DIR - the eigen include directory
+#  EIGEN3_VERSION - eigen version
+#
+# This module reads hints about search locations from 
+# the following enviroment variables:
+#
+# EIGEN3_ROOT
+# EIGEN3_ROOT_DIR
+
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+if(NOT Eigen3_FIND_VERSION)
+  if(NOT Eigen3_FIND_VERSION_MAJOR)
+    set(Eigen3_FIND_VERSION_MAJOR 2)
+  endif(NOT Eigen3_FIND_VERSION_MAJOR)
+  if(NOT Eigen3_FIND_VERSION_MINOR)
+    set(Eigen3_FIND_VERSION_MINOR 91)
+  endif(NOT Eigen3_FIND_VERSION_MINOR)
+  if(NOT Eigen3_FIND_VERSION_PATCH)
+    set(Eigen3_FIND_VERSION_PATCH 0)
+  endif(NOT Eigen3_FIND_VERSION_PATCH)
+
+  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_check_version)
+  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+  if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK FALSE)
+  else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK TRUE)
+  endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+
+  if(NOT EIGEN3_VERSION_OK)
+
+    message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
+                   "but at least version ${Eigen3_FIND_VERSION} is required")
+  endif(NOT EIGEN3_VERSION_OK)
+endmacro(_eigen3_check_version)
+
+if (EIGEN3_INCLUDE_DIR)
+
+  # in cache already
+  _eigen3_check_version()
+  set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+else (EIGEN3_INCLUDE_DIR)
+
+  # search first if an Eigen3Config.cmake is available in the system,
+  # if successful this would set EIGEN3_INCLUDE_DIR and the rest of
+  # the script will work as usual
+  find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)
+
+  if(NOT EIGEN3_INCLUDE_DIR)
+    find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+        HINTS
+        ENV EIGEN3_ROOT 
+        ENV EIGEN3_ROOT_DIR
+        PATHS
+        ${CMAKE_INSTALL_PREFIX}/include
+        ${KDE4_INCLUDE_DIR}
+        PATH_SUFFIXES eigen3 eigen
+      )
+  endif(NOT EIGEN3_INCLUDE_DIR)
+
+  if(EIGEN3_INCLUDE_DIR)
+    _eigen3_check_version()
+  endif(EIGEN3_INCLUDE_DIR)
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(Eigen3
+    FOUND_VAR EIGEN3_FOUND
+    REQUIRED_VARS EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK
+    VERSION_VAR EIGEN3_VERSION)
+
+  mark_as_advanced(EIGEN3_INCLUDE_DIR)
+
+endif(EIGEN3_INCLUDE_DIR)
diff --git a/cmake/GeoModelToolsConfig.cmake b/cmake/GeoModelToolsConfig.cmake
deleted file mode 100644
index 4d9f121..0000000
--- a/cmake/GeoModelToolsConfig.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-include(${SELF_DIR}/GeoModelTools-ExpressionEvaluator.cmake)
-include(${SELF_DIR}/GeoModelTools-JSONParser.cmake)
-include(${SELF_DIR}/GeoModelTools-XMLParser.cmake)
-
diff --git a/cmake/GeoModelToolsConfig.cmake.in b/cmake/GeoModelToolsConfig.cmake.in
new file mode 100644
index 0000000..e8dfa06
--- /dev/null
+++ b/cmake/GeoModelToolsConfig.cmake.in
@@ -0,0 +1,24 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+# First off, import the upstream dependencies of the project.
+find_package( GeoModelCore @GeoModelCore_VERSION@ )
+find_package( GeoModelIO @GeoModelIO_VERSION@ )
+find_package( nlohmann_json @nlohmann_json_VERSION@ )
+find_package( XercesC @XercesC_VERSION@ )
+
+# Include the exported configuration of GeoModelCore.
+get_filename_component( SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH )
+include( ${SELF_DIR}/GeoModelToolsTargets.cmake )
+
+# Set the version of the installed project.
+set( GeoModelTools_VERSION "@PROJECT_VERSION@" )
+
+# Print some standard messages about the package being found.
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( GeoModelTools
+   FOUND_VAR GeoModelTools_FOUND
+   REQUIRED_VARS SELF_DIR
+   VERSION_VAR GeoModelTools_VERSION )
+
+# Clean up.
+unset( SELF_DIR )
diff --git a/cmake/GeoModelToolsPackaging.cmake b/cmake/GeoModelToolsPackaging.cmake
new file mode 100644
index 0000000..fde8202
--- /dev/null
+++ b/cmake/GeoModelToolsPackaging.cmake
@@ -0,0 +1,34 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
+# Set up the basic properties of the package(s).
+set( CPACK_PACKAGE_DESCRIPTION_SUMMARY
+   "${PROJECT_NAME} - ${PROJECT_VERSION}" )
+set( CPACK_PACKAGE_DESCRIPTION
+   "Geometry model tool libraries" )
+set( CPACK_PACKAGE_VERSION "${PROJECT_VERSION}" )
+set( CPACK_PACKAGE_CONTACT "geomodel-developers@cern.ch" )
+
+# Set up the readme and license for the package.
+set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE )
+set( CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README.md )
+set( CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md )
+
+# Set up the handling of the Runtime and Development components during
+# the packaging.
+include( CPackComponent )
+set( CPACK_COMPONENTS_ALL Runtime Development )
+set( CPACK_RPM_COMPONENT_INSTALL TRUE )
+set( CPACK_DEB_COMPONENT_INSTALL TRUE )
+set( CPACK_COMPONENTS_IGNORE_GROUPS TRUE )
+cpack_add_component( Runtime
+   DISPLAY_NAME "GeoModelTools libraries/executables"
+   DESCRIPTION "Core runtime libraries/executables of GeoModelTools"
+   REQUIRED )
+cpack_add_component( Development
+   DISPLAY_NAME "GeoModelTools development"
+   DESCRIPTION "Development package for GeoModelTools"
+   DEPENDS Runtime
+   DISABLED )
+
+# Include the main CPack configuration.
+include( CPack )
-- 
GitLab