summaryrefslogtreecommitdiff
path: root/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/CMakeLists.txt
blob: 484a7d63bfd88d872d1a3178f85c6755ea373ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright(C) 2013  Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; version 2
# of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA

cmake_minimum_required(VERSION 2.6)
project(groonga-normalizer-mysql)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version" VERSION)

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
  set(GROONGA_NORMALIZER_MYSQL_BUNDLED FALSE)
else()
  set(GROONGA_NORMALIZER_MYSQL_BUNDLED TRUE)
endif()

if(GROONGA_NORMALIZER_MYSQL_BUNDLED)
  set(GROONGA_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
  set(GROONGA_LIBRARY_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib")
  set(GROONGA_LIBRARIES "libgroonga")
  set(GROONGA_PLUGINS_DIR "${GRN_RELATIVE_PLUGINS_DIR}")
else()
  include(FindPkgConfig)
  include(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake)

  file(READ
    ${CMAKE_CURRENT_SOURCE_DIR}/required_groonga_version
    GROONGA_REQUIRED_VERSION)
  string(STRIP "${GROONGA_REQUIRED_VERSION}" GROONGA_REQUIRED_VERSION)

  pkg_check_modules(GROONGA REQUIRED "groonga >= ${GROONGA_REQUIRED_VERSION}")
  _pkgconfig_invoke(groonga GROONGA PLUGINS_DIR "" --variable=pluginsdir)
endif()

include_directories(
  ${CMAKE_BINARY_DIR}
  ${GROONGA_INCLUDE_DIRS})

link_directories(
  ${GROONGA_LIBRARY_DIRS})

add_subdirectory(normalizers)

configure_file(
  groonga-normalizer-mysql.pc.in
  "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc"
  @ONLY)

if(NOT GROONGA_NORMALIZER_MYSQL_FOUND)
  install(
    FILES "${CMAKE_CURRENT_BINARY_DIR}/groonga-normalizer-mysql.pc"
    DESTINATION "lib/pkgconfig/")
endif()