Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(cmake): fix curl link of prometheus #397

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ message (STATUS "pegasus Installation directory: CMAKE_INSTALL_PREFIX = " ${CMAK
set(CMAKE_PREFIX_PATH ${PEGASUS_PROJECT_DIR}/rocksdb/build/output;${CMAKE_PREFIX_PATH})
find_package(RocksDB REQUIRED) # RocksDB::rocksdb means librocksdb.a

#prometheus
set(CMAKE_PREFIX_PATH ${DSN_THIRDPARTY_ROOT};${CMAKE_PREFIX_PATH})
find_package(prometheus-cpp)#TODO(huangwei5) make it optional

add_subdirectory(base)
add_subdirectory(reporter)
add_subdirectory(base/test)
Expand Down
10 changes: 10 additions & 0 deletions src/reporter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

# prometheus
set(CMAKE_PREFIX_PATH ${DSN_THIRDPARTY_ROOT};${CMAKE_PREFIX_PATH})
find_package(prometheus-cpp)#TODO(huangwei5): make it optional
# the INTERFACE_LINK_LIBRARIES of prometheus contains the absolute path of libcurl
# when we use the compiled prometheus-cpp libs, the path of libcurl should be our own path
find_package(CURL)
get_target_property(_libs prometheus-cpp::push INTERFACE_LINK_LIBRARIES)
string(REGEX REPLACE ";/.*libcurl\.a" ";${CURL_LIBRARIES}" _libs "${_libs}")
set_target_properties(prometheus-cpp::push PROPERTIES INTERFACE_LINK_LIBRARIES "${_libs}")

dsn_add_static_library()

target_link_libraries(${MY_PROJ_NAME} PUBLIC pegasus_base
Expand Down