From 30db118abd484c59efada27d9d6956b5f68bcee6 Mon Sep 17 00:00:00 2001
From: Robert Kesterson <robert.d.kesterson@leidos.com>
Date: Fri, 4 Sep 2020 16:31:55 +0000
Subject: [PATCH] vcpkg

---
 CMakeLists.txt      | 47 +++++++++++++++++++++++++++++++++++++++++++--
 croncppConfig.cmake |  1 +
 2 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 croncppConfig.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9114b39..8d46e6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.7.0)
-project(croncpp)
+project(croncpp VERSION 1.0.0)
 
 if(WIN32)
    message(status "Setting MSVC flags")
@@ -24,4 +24,47 @@ if(BUILD_TESTS)
 endif()
 
 add_subdirectory(benchmark)
-add_subdirectory(test)
\ No newline at end of file
+add_subdirectory(test)
+
+add_library( croncpp INTERFACE )
+add_library( croncpp::croncpp ALIAS croncpp )
+
+include(GNUInstallDirs)
+target_include_directories( croncpp INTERFACE
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+    $<INSTALL_INTERFACE:include> )
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.15)
+    # public headers will get installed:
+    set_target_properties( croncpp PROPERTIES PUBLIC_HEADER include/croncpp.h )
+endif ()
+
+
+set( version_config "${CMAKE_CURRENT_BINARY_DIR}/croncppConfigVersion.cmake" )
+
+include( CMakePackageConfigHelpers )
+write_basic_package_version_file( "${version_config}"
+    VERSION ${PROJECT_VERSION}
+    COMPATIBILITY SameMajorVersion )
+
+message(STATUS "CMAKE_INSTALL_INCLUDEDIR = ${CMAKE_INSTALL_INCLUDEDIR}")
+
+install( TARGETS croncpp
+    EXPORT croncppConfig
+    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/croncpp )
+export( TARGETS croncpp NAMESPACE croncpp:: FILE croncppTargets.cmake )
+if (CMAKE_VERSION VERSION_LESS 3.15)
+    install(
+        FILES include/croncpp.h
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/croncpp )
+endif ()
+
+set( CONFIG_LOC "share/croncpp" )
+
+install( EXPORT croncppConfig
+  FILE croncppTargets.cmake
+  NAMESPACE croncpp::
+  DESTINATION ${CONFIG_LOC} )
+install (
+  FILES croncppConfig.cmake "${version_config}"
+  DESTINATION ${CONFIG_LOC})
diff --git a/croncppConfig.cmake b/croncppConfig.cmake
new file mode 100644
index 0000000..3c4702c
--- /dev/null
+++ b/croncppConfig.cmake
@@ -0,0 +1 @@
+include( "${CMAKE_CURRENT_LIST_DIR}/croncppTargets.cmake" )
-- 
2.20.1