summaryrefslogtreecommitdiff
path: root/Utilities/cmnghttp2
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-01 14:08:51 -0400
committerBrad King <brad.king@kitware.com>2020-04-03 06:43:00 -0400
commit0b872fd4beee649103f0e737fca5838c2b6a1e88 (patch)
treeb7cee0b687e75d5de12f3fdac89f2c26650af769 /Utilities/cmnghttp2
parentcd5a320d68824c630661748f632ea5f2008d9a4f (diff)
downloadcmake-0b872fd4beee649103f0e737fca5838c2b6a1e88.tar.gz
nghttp2: Build the library within CMake for use by our curl
Provide our own minimal `config.h` since the upstream one is much larger to support other parts of its distribution. Compile with warnings disabled since this is third-party code.
Diffstat (limited to 'Utilities/cmnghttp2')
-rw-r--r--Utilities/cmnghttp2/CMakeLists.txt52
-rw-r--r--Utilities/cmnghttp2/cmakeconfig.h.in17
2 files changed, 69 insertions, 0 deletions
diff --git a/Utilities/cmnghttp2/CMakeLists.txt b/Utilities/cmnghttp2/CMakeLists.txt
new file mode 100644
index 0000000000..3a11acec60
--- /dev/null
+++ b/Utilities/cmnghttp2/CMakeLists.txt
@@ -0,0 +1,52 @@
+# Disable warnings to avoid changing 3rd party code.
+if(CMAKE_C_COMPILER_ID MATCHES
+ "^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
+elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
+endif()
+
+# Re-use some check result cache entries from cmcurl:
+# * HAVE_ARPA_INET_H
+# * HAVE_NETINET_IN_H
+# * HAVE_SSIZE_T
+if(NOT HAVE_SSIZE_T)
+ set(ssize_t KWIML_INT_intptr_t)
+endif()
+configure_file(cmakeconfig.h.in config.h)
+
+add_library(cmnghttp2 STATIC
+ lib/nghttp2_buf.c
+ lib/nghttp2_callbacks.c
+ lib/nghttp2_debug.c
+ lib/nghttp2_frame.c
+ lib/nghttp2_hd.c
+ lib/nghttp2_hd_huffman.c
+ lib/nghttp2_hd_huffman_data.c
+ lib/nghttp2_helper.c
+ lib/nghttp2_http.c
+ lib/nghttp2_map.c
+ lib/nghttp2_mem.c
+ lib/nghttp2_npn.c
+ lib/nghttp2_option.c
+ lib/nghttp2_outbound_item.c
+ lib/nghttp2_pq.c
+ lib/nghttp2_priority_spec.c
+ lib/nghttp2_queue.c
+ lib/nghttp2_rcbuf.c
+ lib/nghttp2_session.c
+ lib/nghttp2_stream.c
+ lib/nghttp2_submit.c
+ lib/nghttp2_version.c
+ )
+
+target_compile_definitions(cmnghttp2
+ PUBLIC NGHTTP2_STATICLIB
+ PRIVATE HAVE_CONFIG_H
+ )
+target_include_directories(cmnghttp2 PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/lib/includes
+ )
+
+install(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmnghttp2)
diff --git a/Utilities/cmnghttp2/cmakeconfig.h.in b/Utilities/cmnghttp2/cmakeconfig.h.in
new file mode 100644
index 0000000000..d6693ee578
--- /dev/null
+++ b/Utilities/cmnghttp2/cmakeconfig.h.in
@@ -0,0 +1,17 @@
+#if defined(_MSC_VER)
+# pragma warning(push,1)
+#endif
+
+#include <cm_kwiml.h>
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine ssize_t @ssize_t@
+
+/* sizeof(int *) */
+#define SIZEOF_INT_P KWIML_ABI_SIZEOF_DATA_PTR
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#cmakedefine HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#cmakedefine HAVE_NETINET_IN_H 1