Skip to content

Commit

Permalink
Merge pull request #159 from rainbeam/explicit-curl-link
Browse files Browse the repository at this point in the history
make curl dependency link modular
  • Loading branch information
bobsummerwill committed Apr 29, 2016
2 parents 5427d3b + d6b44a6 commit ccae033
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 11 additions & 0 deletions cmake/UseCURL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function(eth_apply TARGET REQUIRED)
find_package (CURL)
eth_show_dependency(CURL curl)

if (CURL_FOUND)
target_include_directories(${TARGET} SYSTEM PUBLIC ${CURL_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${CURL_LIBRARIES})
elseif (NOT ${REQUIRED} STREQUAL "OPTIONAL")
message(FATAL_ERROR "Curl library not found")
endif()
endfunction()
6 changes: 2 additions & 4 deletions cmake/UseJsonRpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ function(eth_apply TARGET REQUIRED SUBMODULE)
find_package (json_rpc_cpp 0.4)
find_program(ETH_JSON_RPC_STUB jsonrpcstub)
eth_show_dependency(JSON_RPC_CPP json-rpc-cpp)
find_package(CURL)
eth_show_dependency(CURL curl)

eth_use(${TARGET} ${REQUIRED} CURL)

if (${SUBMODULE} STREQUAL "Server")
eth_use(${TARGET} ${REQUIRED} Mhd)
Expand All @@ -21,9 +21,7 @@ function(eth_apply TARGET REQUIRED SUBMODULE)

if (${SUBMODULE} STREQUAL "Client")
target_include_directories(${TARGET} SYSTEM PUBLIC ${JSON_RPC_CPP_INCLUDE_DIRS})
target_include_directories(${TARGET} SYSTEM PUBLIC ${CURL_INCLUDE_DIRS})
target_link_libraries(${TARGET} ${JSON_RPC_CPP_CLIENT_LIBRARIES})
target_link_libraries(${TARGET} ${CURL_LIBRARIES})
target_compile_definitions(${TARGET} PUBLIC ETH_JSONRPC)

eth_copy_dlls(${TARGET} CURL_DLLS)
Expand Down

0 comments on commit ccae033

Please sign in to comment.