vcpkg/ports/brpc/fix-glog.patch
Cheney Wang a03284c722
[brpc] update to 1.9.0 (#38918)
Fixes https://github.com/microsoft/vcpkg/issues/38799
Update `brpc` to the latest version 1.9.0.
No feature needs to be tested.
Remove unnecessary patch file.
- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] ~The "supports" clause reflects platforms that may be fixed by
this new version.~
- [ ] ~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-05-27 14:33:42 -07:00

98 lines
3.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecce87c..3d938d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,8 +86,10 @@ configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_SOURCE_DIR}/src/butil
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
-find_package(GFLAGS REQUIRED)
-
+set(GFLAGS_USE_TARGET_NAMESPACE ON)
+find_package(gflags CONFIG REQUIRED)
+set(GFLAGS_LIBRARY gflags::gflags)
+if(0)
execute_process(
COMMAND bash -c "grep \"namespace [_A-Za-z0-9]\\+ {\" ${GFLAGS_INCLUDE_PATH}/gflags/gflags_declare.h | head -1 | awk '{print $2}' | tr -d '\n'"
OUTPUT_VARIABLE GFLAGS_NS
@@ -98,6 +100,8 @@ if(${GFLAGS_NS} STREQUAL "GFLAGS_NAMESPACE")
OUTPUT_VARIABLE GFLAGS_NS
)
endif()
+endif()
+set(GFLAGS_NS "google")
include_directories(
${PROJECT_SOURCE_DIR}/src
@@ -127,19 +131,19 @@ set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEBUG_SYMBOL} ${THRIFT_CPP_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_CPP_FLAGS} -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer")
-macro(use_cxx11)
+macro(use_cxx14)
if(CMAKE_VERSION VERSION_LESS "3.1.3")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
else()
- set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
-endmacro(use_cxx11)
+endmacro(use_cxx14)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
#required by butil/crc32.cc to boost performance for 10x
@@ -199,7 +203,7 @@ if(Protobuf_VERSION GREATER 4.21)
absl::variant
)
else()
- use_cxx11()
+ use_cxx14()
endif()
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8e836a4..c1b1f36 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,6 +30,10 @@ add_dependencies(SOURCES_LIB PROTO_LIB)
# shared library needs POSITION_INDEPENDENT_CODE
set_property(TARGET ${SOURCES_LIB} PROPERTY POSITION_INDEPENDENT_CODE 1)
set_property(TARGET ${BUTIL_LIB} PROPERTY POSITION_INDEPENDENT_CODE 1)
+if(BRPC_WITH_GLOG)
+ target_link_libraries(BUTIL_LIB PUBLIC ${GLOG_LIB})
+ target_link_libraries(SOURCES_LIB PUBLIC ${GLOG_LIB})
+endif()
if(NOT BUILD_SHARED_LIBS)
add_library(brpc-static STATIC $<TARGET_OBJECTS:BUTIL_LIB>
@@ -65,9 +69,7 @@ if(WITH_THRIFT)
endif()
target_link_libraries(brpc-static PUBLIC ${DYNAMIC_LIB})
-if(BRPC_WITH_GLOG)
- target_link_libraries(brpc-static PUBLIC ${GLOG_LIB})
-endif()
+
target_include_directories(brpc-static PUBLIC $<INSTALL_INTERFACE:include>)
SET_TARGET_PROPERTIES(brpc-static PROPERTIES OUTPUT_NAME brpc CLEAN_DIRECT_OUTPUT 1)
@@ -90,9 +92,7 @@ if(BUILD_SHARED_LIBS)
$<TARGET_OBJECTS:PROTO_LIB>)
target_link_libraries(brpc-shared PUBLIC ${DYNAMIC_LIB})
target_include_directories(brpc-shared PUBLIC $<INSTALL_INTERFACE:include>)
- if(WITH_GLOG)
- target_link_libraries(brpc-shared PUBLIC ${GLOG_LIB})
- endif()
+
if(WITH_THRIFT)
target_link_libraries(brpc-shared PUBLIC ${THRIFT_LIB})
endif()