|
| 1 | +# Copyright (C) 2021 HERE Europe B.V. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | +# License-Filename: LICENSE |
| 17 | + |
| 18 | +cmake_minimum_required(VERSION 3.9) |
| 19 | + |
| 20 | +project(lmdb VERSION 0.9.29 LANGUAGES C) |
| 21 | + |
| 22 | +set(CMAKE_C_STANDARD 11) |
| 23 | +set(CMAKE_C_STANDARD_REQUIRED ON) |
| 24 | +set(CMAKE_C_EXTENSIONS OFF) |
| 25 | + |
| 26 | +set(LMDB_SOURCE_DIR "libraries/liblmdb") |
| 27 | + |
| 28 | +add_library(lmdb "") |
| 29 | + |
| 30 | +target_sources(lmdb |
| 31 | + PRIVATE |
| 32 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/lmdb.h" |
| 33 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/mdb.c" |
| 34 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/midl.c" |
| 35 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/midl.h" |
| 36 | +) |
| 37 | + |
| 38 | +target_include_directories(lmdb |
| 39 | + PUBLIC |
| 40 | + $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> |
| 41 | + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> |
| 42 | +) |
| 43 | + |
| 44 | +include(GNUInstallDirs) |
| 45 | +install(TARGETS lmdb |
| 46 | + EXPORT lmdbTargets |
| 47 | + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 48 | + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 49 | + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 50 | +) |
| 51 | +install( |
| 52 | + FILES |
| 53 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/lmdb.h" |
| 54 | + "${PROJECT_SOURCE_DIR}/${LMDB_SOURCE_DIR}/midl.h" |
| 55 | + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lmdb |
| 56 | + ) |
| 57 | +install( |
| 58 | + EXPORT lmdbTargets |
| 59 | + NAMESPACE lmdb:: |
| 60 | + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/lmdb" |
| 61 | +) |
| 62 | +install( |
| 63 | + FILES |
| 64 | + "${PROJECT_SOURCE_DIR}/cmake/lmdbConfig.cmake" |
| 65 | + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/lmdb" |
| 66 | +) |
0 commit comments