From ee9e61ac5ffb47eca60a2c3d8cafdba60fd8404f Mon Sep 17 00:00:00 2001 From: zjyhjqs Date: Sun, 29 Sep 2024 23:59:36 +0800 Subject: [PATCH] Add support for CPack --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c784f3c7..4b9f57d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,13 @@ cmake_minimum_required(VERSION 3.16) -project(googletest-distribution) set(GOOGLETEST_VERSION 1.16.0) +project(googletest-distribution + VERSION ${GOOGLETEST_VERSION} + DESCRIPTION "Google's C++ test framework" + HOMEPAGE_URL "https://google.github.io/googletest" + LANGUAGES CXX +) if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) set(CMAKE_CXX_EXTENSIONS OFF) @@ -34,3 +39,12 @@ if(BUILD_GMOCK) else() add_subdirectory( googletest ) endif() + +if(INSTALL_GTEST) + set(CPACK_PACKAGE_NAME "GTest") # same as the name in `find_package` + set(CPACK_PACKAGE_VENDOR "Google") + set(CPACK_GENERATOR "TGZ") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + include(CPack) +endif()