Unverified Commit 82e02316 authored by Feng Xiao's avatar Feng Xiao Committed by GitHub

Merge pull request #4259 from Mizux/master

Various CMake Update
parents 5dad7cce 1ec9beb4
...@@ -8,6 +8,10 @@ endif() ...@@ -8,6 +8,10 @@ endif()
# CMake policies # CMake policies
cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0022 NEW)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
# Project # Project
project(protobuf C CXX) project(protobuf C CXX)
...@@ -24,11 +28,7 @@ option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHAR ...@@ -24,11 +28,7 @@ option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHAR
include(CMakeDependentOption) include(CMakeDependentOption)
cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON
"NOT protobuf_BUILD_SHARED_LIBS" OFF) "NOT protobuf_BUILD_SHARED_LIBS" OFF)
if (MSVC) set(protobuf_WITH_ZLIB_DEFAULT ON)
set(protobuf_WITH_ZLIB_DEFAULT OFF)
else (MSVC)
set(protobuf_WITH_ZLIB_DEFAULT ON)
endif (MSVC)
option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT})
set(protobuf_DEBUG_POSTFIX "d" set(protobuf_DEBUG_POSTFIX "d"
CACHE STRING "Default debug postfix") CACHE STRING "Default debug postfix")
......
...@@ -62,5 +62,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS) ...@@ -62,5 +62,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
PRIVATE LIBPROTOBUF_EXPORTS) PRIVATE LIBPROTOBUF_EXPORTS)
endif() endif()
set_target_properties(libprotobuf-lite PROPERTIES set_target_properties(libprotobuf-lite PROPERTIES
VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
...@@ -125,5 +125,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS) ...@@ -125,5 +125,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
PRIVATE LIBPROTOBUF_EXPORTS) PRIVATE LIBPROTOBUF_EXPORTS)
endif() endif()
set_target_properties(libprotobuf PROPERTIES set_target_properties(libprotobuf PROPERTIES
VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protobuf OUTPUT_NAME ${LIB_PREFIX}protobuf
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf ALIAS libprotobuf)
...@@ -225,5 +225,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS) ...@@ -225,5 +225,7 @@ if(MSVC AND protobuf_BUILD_SHARED_LIBS)
endif() endif()
set_target_properties(libprotoc PROPERTIES set_target_properties(libprotoc PROPERTIES
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
VERSION ${protobuf_VERSION}
OUTPUT_NAME ${LIB_PREFIX}protoc OUTPUT_NAME ${LIB_PREFIX}protoc
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotoc ALIAS libprotoc)
...@@ -4,3 +4,4 @@ set(protoc_files ...@@ -4,3 +4,4 @@ set(protoc_files
add_executable(protoc ${protoc_files}) add_executable(protoc ${protoc_files})
target_link_libraries(protoc libprotobuf libprotoc) target_link_libraries(protoc libprotobuf libprotoc)
add_executable(protobuf::protoc ALIAS protoc)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment