summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-11-29 15:32:38 +0800
committerPeng Wu <alexepico@gmail.com>2016-11-29 15:32:38 +0800
commitabed0b59cbeb3e129082b40df844bf148b8b96db (patch)
treec625d1d2d658a9f23ec10c666580f15080b9d900
parent710b68d071ee95a58421acbdfca8154ba56502ac (diff)
downloadlibpinyin-abed0b59cbeb3e129082b40df844bf148b8b96db.tar.gz
libpinyin-abed0b59cbeb3e129082b40df844bf148b8b96db.tar.xz
libpinyin-abed0b59cbeb3e129082b40df844bf148b8b96db.zip
update cmake files
-rw-r--r--CMakeLists.txt25
-rw-r--r--config.h.cmake23
2 files changed, 47 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09421f6..5c49d2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,13 +58,30 @@ check_function_exists(memset HAVE_MEMSET)
check_function_exists(realloc HAVE_REALLOC)
check_function_exists(setlocale HAVE_SETLOCALE)
check_function_exists(stat HAVE_STAT)
+check_function_exists(mmap HAVE_MMAP)
include(CheckTypeSize)
check_type_size(size_t SIZE_OF_SIZE_T)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(GLIB2 REQUIRED)
-find_package(BerkeleyDB REQUIRED)
+
+# DBM: BerkeleyDB
+find_package(BerkeleyDB)
+if (DB_FOUND)
+ include_directories ( ${DB_INCLUDE_DIR} )
+ SET (LIBS ${LIBS} ${DB_LIBRARIES})
+ SET (HAVE_BERKELEY_DB 1)
+endif (DB_FOUND)
+
+# DBM: Kyoto Cabinet
+find_package(KyotoCabinet)
+if (KyotoCabinet_FOUND)
+ include_directories ( ${KyotoCabinet_INCLUDE_PATH} )
+ SET (LIBS ${LIBS} ${KyotoCabinet_LIBRARY})
+ SET (HAVE_KYOTO_CABINET 1)
+endif (KyotoCabinet_FOUND)
+
######## Windows
@@ -117,6 +134,12 @@ configure_file(
@ONLY
)
+configure_file(
+ config.h.cmake
+ config.h
+ @ONLY
+)
+
install(
FILES
${CMAKE_BINARY_DIR}/libpinyin.pc
diff --git a/config.h.cmake b/config.h.cmake
new file mode 100644
index 0000000..dadb3de
--- /dev/null
+++ b/config.h.cmake
@@ -0,0 +1,23 @@
+/*--------------------------------------------------------------------------
+ * This file is autogenerated from config.h.in
+ * during the cmake configuration of your project. If you need to make changes
+ * edit the original file NOT THIS FILE.
+ * --------------------------------------------------------------------------*/
+#ifndef _CONFIGURATION_HEADER_GUARD_H_
+#define _CONFIGURATION_HEADER_GUARD_H_
+
+/* Define to 1 if you have a working `mmap' system call. */
+#cmakedefine HAVE_MMAP @HAVE_MMAP@
+
+/* Have Berkeley DB. */
+#cmakedefine HAVE_BERKELEY_DB @HAVE_BERKELEY_DB@
+
+/* Have Kyoto Cabinet. */
+#cmakedefine HAVE_KYOTO_CABINET @HAVE_KYOTO_CABINET@
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+#endif