diff --git a/CMakeLists.txt b/CMakeLists.txt
index be7d7466fc449dcb81ad4fcdf75a35f93d3fdb93..6ef9cf8feb6cae24e1804fda35562bd093511b20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -463,13 +463,17 @@ if(ENABLE_GMM)
 endif(ENABLE_GMM)
 
 if(ENABLE_KBIPACK)
-  add_subdirectory(contrib/kbipack)
-  include_directories(contrib/kbipack)
-  set_config_option(HAVE_KBIPACK "Kbipack")
   find_library(GMP_LIB NAMES gmp)
   if(GMP_LIB)
-    set_config_option(HAVE_GMP "GMP")
-    list(APPEND EXTERNAL_LIBRARIES ${GMP_LIB})
+    find_path(GMP_INC "gmp.h" PATH_SUFFIXES src include)
+    if(GMP_INC)
+      set_config_option(HAVE_GMP "GMP")
+      list(APPEND EXTERNAL_LIBRARIES ${GMP_LIB})
+      list(APPEND EXTERNAL_INCLUDES ${GMP_INC})
+      add_subdirectory(contrib/kbipack)
+      include_directories(contrib/kbipack)
+      set_config_option(HAVE_KBIPACK "Kbipack")
+    endif(GMP_INC)
   endif(GMP_LIB)
 endif(ENABLE_KBIPACK)