diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a13333..2dd274c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -431,6 +431,9 @@ if(USE_NGHTTP2)
   find_package(NGHTTP2 REQUIRED)
   include_directories(${NGHTTP2_INCLUDE_DIRS})
   list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})
+  if(NOT BUILD_SHARED_LIBS)
+    add_definitions(-DNGHTTP2_STATICLIB)
+  endif()
 endif()
 
 function(CheckQuicSupportInOpenSSL)
