Skip to content

Instantly share code, notes, and snippets.

@kamikat
Last active April 9, 2016 07:42
Show Gist options
  • Save kamikat/b3e575516cc0d743f705187d3f562152 to your computer and use it in GitHub Desktop.
Save kamikat/b3e575516cc0d743f705187d3f562152 to your computer and use it in GitHub Desktop.
nghttp2 cmake config files
include(${CMAKE_CURRENT_LIST_DIR}/nghttp2Config.cmake)
find_package(Boost REQUIRED COMPONENTS system)
find_package(PkgConfig)
pkg_search_module(ngHTTP2_asio REQUIRED libnghttp2_asio)
find_library(ngHTTP2_asio_LOCATION NAMES ${ngHTTP2_asio_LIBRARIES})
add_library(nghttp2_asio UNKNOWN IMPORTED)
set_property(TARGET nghttp2_asio PROPERTY IMPORTED_LOCATION ${ngHTTP2_asio_LOCATION})
set_property(TARGET nghttp2
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${ngHTTP2_asio_INCLUDE_DIRS})
set_property(TARGET nghttp2_asio PROPERTY INTERFACE_LINK_LIBRARIES nghttp2 ${Boost_LIBRARIES})
set_property(TARGET nghttp2_asio APPEND PROPERTY INTERFACE_COMPILE_OPTIONS -std=c++11)
find_package(PkgConfig)
pkg_search_module(OpenSSL REQUIRED openssl)
pkg_search_module(ngHTTP2 REQUIRED libnghttp2)
find_library(ngHTTP2_LOCATION NAMES ${ngHTTP2_LIBRARIES})
# Resolve OpenSSL library names to paths (fixes conflict with default ssl implementation on OS X)
foreach(name ${OpenSSL_LIBRARIES})
find_library(${name}_LOCATION ${name} PATHS ${OpenSSL_LIBRARY_DIRS} NO_DEFAULT_PATH)
list(APPEND OpenSSL_LIBRARIES_ ${${name}_LOCATION})
endforeach()
set(OpenSSL_LIBRARIES ${OpenSSL_LIBRARIES_})
add_library(nghttp2 UNKNOWN IMPORTED)
set_property(TARGET nghttp2 PROPERTY IMPORTED_LOCATION ${ngHTTP2_LOCATION})
set_property(TARGET nghttp2
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${ngHTTP2_INCLUDE_DIRS}
${OpenSSL_INCLIDE_DIRS})
set_property(TARGET nghttp2
PROPERTY INTERFACE_LINK_LIBRARIES ${OpenSSL_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment