From abed0b59cbeb3e129082b40df844bf148b8b96db Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 29 Nov 2016 15:32:38 +0800 Subject: update cmake files --- CMakeLists.txt | 25 ++++++++++++++++++++++++- config.h.cmake | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 config.h.cmake 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 -- cgit