mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Add PROJECT_IS_TOP_LEVEL variable, to decide whether need to install/package
This commit is contained in:
parent
ee9e61ac5f
commit
0e0bea862c
@ -11,6 +11,10 @@ project(googletest-distribution
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(PROJECT_IS_TOP_LEVEL TRUE)
|
||||
endif()
|
||||
|
||||
if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
@ -22,7 +26,7 @@ include(GNUInstallDirs)
|
||||
|
||||
# Note that googlemock target already builds googletest.
|
||||
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
|
||||
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
|
||||
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)
|
||||
|
||||
if(GTEST_HAS_ABSL)
|
||||
@ -40,7 +44,7 @@ else()
|
||||
add_subdirectory( googletest )
|
||||
endif()
|
||||
|
||||
if(INSTALL_GTEST)
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
set(CPACK_PACKAGE_NAME "GTest") # same as the name in `find_package`
|
||||
set(CPACK_PACKAGE_VENDOR "Google")
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user