Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com>2020-05-07 02:57:50 +0300
committerGitHub <noreply@github.com>2020-05-07 02:57:50 +0300
commit839de217079028eaf0c7f39b6a06b499014dabba (patch)
treef4e561637113ed8c8396c9145e68dbc7d314b968 /CMakeLists.txt
parent1999b48a519196711f0d03af3b7eedd49fcc6db3 (diff)
parentde053645bb8a47cc4cbb8c1b2e47a33d5f5ef18d (diff)
Merge pull request #879 from leha-bot/cmake/add-version-to-cmake-project
CMakeLists: add VERSION to project() and package
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a12c33..0cf66f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1.3...3.16)
-project(GSL CXX)
+project(GSL VERSION 3.0.2 LANGUAGES CXX)
include(ExternalProject)
find_package(Git)
@@ -92,6 +92,17 @@ install(
install(EXPORT Microsoft.GSLConfig NAMESPACE Microsoft.GSL:: DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/Microsoft.GSL)
export(TARGETS GSL NAMESPACE Microsoft.GSL:: FILE Microsoft.GSLConfig.cmake)
+# Add find_package() versioning support. The version for
+# generated Microsoft.GSLConfigVersion.cmake will be used from
+# last project() command. The version's compatibility is set between all
+# minor versions (as it was in prev. GSL releases).
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/Microsoft.GSLConfigVersion.cmake
+ COMPATIBILITY SameMajorVersion
+)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Microsoft.GSLConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/Microsoft.GSL)
+
# Add Microsoft.GSL::GSL alias for GSL so that dependents can be agnostic about
# whether GSL was added via `add_subdirectory` or `find_package`
add_library(Microsoft.GSL::GSL ALIAS GSL)