Files
phxrpc/CMakeLists.txt
tqcq 3d37691459
All checks were successful
phxrpc / build (Debug, arm-linux-gnueabihf) (push) Successful in 4m26s
phxrpc / build (Debug, aarch64-linux-gnu) (push) Successful in 5m33s
phxrpc / build (Debug, host.gcc) (push) Successful in 4m41s
phxrpc / build (Release, host.gcc) (push) Successful in 3m11s
phxrpc / build (Release, arm-linux-gnueabihf) (push) Successful in 5m38s
phxrpc / build (Release, mipsel-linux-gnu) (push) Successful in 6m41s
phxrpc / build (Release, aarch64-linux-gnu) (push) Successful in 3m22s
phxrpc / build (Debug, mipsel-linux-gnu) (push) Successful in 5m33s
feat add SOVERSION for libphxrpc.so
2025-08-11 16:18:59 +08:00

61 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.10)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
project(
phxrpc
LANGUAGES C CXX
VERSION 0.0.1.0)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(FetchContent)
set(protobuf_WITH_ZLIB
OFF
CACHE INTERNAL "without zlib")
set(protobuf_BUILD_TESTS
OFF
CACHE INTERNAL "without tests")
set(protobuf_protobuf_BUILD_SHARED_LIBS
OFF
CACHE INTERNAL "use static library")
set(protobuf_BUILD_LIBPROTOC
ON
CACHE INTERNAL "build libprotoc")
set(protobuf_BUILD_PROTOC_BINARIES
ON
CACHE INTERNAL "build binaries")
FetchContent_Declare(
protobuf
SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf-21.12
DOWNLOAD_EXTRACT_TIMESTAMP
EXCLUDE_FROM_ALL
# URL
# https://github.com/protocolbuffers/protobuf/archive/refs/tags/v6.31.1.zip
# URL_HASH MD5=2e36cb724b5d50880002501e154a29f2
)
FetchContent_MakeAvailable(protobuf)
FetchContent_GetProperties(protobuf)
if(NOT protobuf_POPULATED)
FetchContent_Populate(protobuf)
add_subdirectory(${protobuf_SOURCE_DIR} ${protobuf_BINARY_DIR}
EXCLUDE_FROM_ALL)
endif()
install(
DIRECTORY ${protobuf_SOURCE_DIR}/src/google
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.inc"
PATTERN "*.proto")
set_target_properties(protoc PROPERTIES EXCLUDE_FROM_ALL FALSE)
install(TARGETS protoc DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(codegen)
add_subdirectory(phxrpc)