CMakeLists.txt 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
set(MY_PROJ_NAME "pegasus_reporter")
project(${MY_PROJ_NAME} C CXX)

# Source files under CURRENT project directory will be automatically included.
# You can manually set MY_PROJ_SRC to include source files under other directories.
set(MY_PROJ_SRC "")

# Search mode for source files under CURRENT project directory?
# "GLOB_RECURSE" for recursive search
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

13 14 15 16 17 18
# 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)
19
get_target_property(_libs prometheus-cpp::pull INTERFACE_LINK_LIBRARIES)
20
string(REGEX REPLACE ";/.*libcurl\.a" ";${CURL_LIBRARIES}" _libs "${_libs}")
21
set_target_properties(prometheus-cpp::pull PROPERTIES INTERFACE_LINK_LIBRARIES "${_libs}")
22

23
dsn_add_static_library()
24

25
target_link_libraries(${MY_PROJ_NAME} PUBLIC pegasus_base
26
                                            prometheus-cpp::pull
27
                                            ) # TODO(huangwei5): dsn_add_static_library doesnt link libs, need fix