Set gRPC_INSTALL to ON by default for MSVC and OFF if a subproject

Now that gRPC_INSTALL is forced off if using bundled third-party
libraries, it no longer makes sense to set it OFF by default for MSVC.

However, we do want to set it OFF by default if gRPC is being built as a
subproject of another project.
pull/11140/head
Alex Merry 8 years ago
parent c17eb5c37e
commit a65f006d21
  1. 5
      CMakeLists.txt
  2. 5
      templates/CMakeLists.txt.template

@ -49,8 +49,9 @@ project(${PACKAGE_NAME} C CXX)
option(gRPC_BUILD_TESTS "Build tests" OFF) option(gRPC_BUILD_TESTS "Build tests" OFF)
set(gRPC_INSTALL_default ON) set(gRPC_INSTALL_default ON)
if (MSVC) if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(gRPC_INSTALL_default OFF) # Disable gRPC_INSTALL by default if building as a submodule
set(gRPC_INSTALL_default OFF)
endif() endif()
set(gRPC_INSTALL ${gRPC_INSTALL_default} CACHE BOOL set(gRPC_INSTALL ${gRPC_INSTALL_default} CACHE BOOL
"Generate installation target: gRPC_ZLIB_PROVIDER, gRPC_CARES_PROVIDER, gRPC_SSL_PROVIDER and gRPC_PROTOBUF_PROVIDER must all be \"package\"") "Generate installation target: gRPC_ZLIB_PROVIDER, gRPC_CARES_PROVIDER, gRPC_SSL_PROVIDER and gRPC_PROTOBUF_PROVIDER must all be \"package\"")

@ -93,8 +93,9 @@
option(gRPC_BUILD_TESTS "Build tests" OFF) option(gRPC_BUILD_TESTS "Build tests" OFF)
set(gRPC_INSTALL_default ON) set(gRPC_INSTALL_default ON)
if (MSVC) if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(gRPC_INSTALL_default OFF) # Disable gRPC_INSTALL by default if building as a submodule
set(gRPC_INSTALL_default OFF)
endif() endif()
set(gRPC_INSTALL <%text>${gRPC_INSTALL_default}</%text> CACHE BOOL set(gRPC_INSTALL <%text>${gRPC_INSTALL_default}</%text> CACHE BOOL
"Generate installation target: gRPC_ZLIB_PROVIDER, gRPC_CARES_PROVIDER, gRPC_SSL_PROVIDER and gRPC_PROTOBUF_PROVIDER must all be \"package\"") "Generate installation target: gRPC_ZLIB_PROVIDER, gRPC_CARES_PROVIDER, gRPC_SSL_PROVIDER and gRPC_PROTOBUF_PROVIDER must all be \"package\"")

Loading…
Cancel
Save