Skip to content

Commit

Permalink
Merge pull request #1872 from bitshares/jmj_static_linux
Browse files Browse the repository at this point in the history
modified CMakeLists.txt for static linking of libcurl
  • Loading branch information
jmjatlanta authored Jul 30, 2019
2 parents 2b5d3d0 + 98bd37e commit 9990f9f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
include(CheckCCompilerFlag)
include(Utils)

# function to help with cUrl
macro(FIND_CURL)
if (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
set (OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES .a)
find_package(CURL REQUIRED)
list(APPEND CURL_LIBRARIES ssl crypto)
set (CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
find_package(CURL REQUIRED)
endif (NOT WIN32 AND NOT APPLE AND CURL_STATICLIB)
endmacro()

# Fortify source
if (CMAKE_COMPILER_IS_GNUCXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down
4 changes: 3 additions & 1 deletion libraries/plugins/elasticsearch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ file(GLOB HEADERS "include/graphene/elasticsearch/*.hpp")
add_library( graphene_elasticsearch
elasticsearch_plugin.cpp
)
find_package(CURL REQUIRED)

find_curl()

include_directories(${CURL_INCLUDE_DIRS})
if(MSVC)
set_source_files_properties(elasticsearch_plugin.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
Expand Down
4 changes: 3 additions & 1 deletion libraries/plugins/es_objects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ file(GLOB HEADERS "include/graphene/es_objects/*.hpp")
add_library( graphene_es_objects
es_objects.cpp
)
find_package(CURL REQUIRED)

find_curl()

include_directories(${CURL_INCLUDE_DIRS})
if(CURL_STATICLIB)
SET_TARGET_PROPERTIES(graphene_es_objects PROPERTIES
Expand Down
4 changes: 3 additions & 1 deletion libraries/utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ set(sources

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_revision.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" @ONLY)
list(APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp")
find_package(CURL REQUIRED)

find_curl()

include_directories(${CURL_INCLUDE_DIRS})
add_library( graphene_utilities
${sources}
Expand Down

0 comments on commit 9990f9f

Please sign in to comment.