diff --git a/CMakeLists.txt b/CMakeLists.txt index 91f4dd95d0..4540350f8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/libraries/plugins/elasticsearch/CMakeLists.txt b/libraries/plugins/elasticsearch/CMakeLists.txt index ce9c7c1d1d..c7810f4eb3 100644 --- a/libraries/plugins/elasticsearch/CMakeLists.txt +++ b/libraries/plugins/elasticsearch/CMakeLists.txt @@ -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" ) diff --git a/libraries/plugins/es_objects/CMakeLists.txt b/libraries/plugins/es_objects/CMakeLists.txt index 42d18a6580..2cae2ffde4 100644 --- a/libraries/plugins/es_objects/CMakeLists.txt +++ b/libraries/plugins/es_objects/CMakeLists.txt @@ -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 diff --git a/libraries/utilities/CMakeLists.txt b/libraries/utilities/CMakeLists.txt index 4311ef46cb..c4c01cd212 100644 --- a/libraries/utilities/CMakeLists.txt +++ b/libraries/utilities/CMakeLists.txt @@ -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}