[leveldb] Fix cmake config (#7245)

This commit is contained in:
Phoebe 2019-07-16 02:20:11 +08:00 committed by Phil Christensen
parent 84a0270693
commit d3829ff3a1
5 changed files with 42 additions and 21 deletions

View File

@ -1,4 +1,4 @@
Source: leveldb
Version: 1.22
Version: 1.22-1
Homepage: https://github.com/bitcoin-core/leveldb
Description: LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.

View File

@ -1,19 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1409c06..c81d219 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -440,12 +440,12 @@ if(LEVELDB_INSTALL)
install(
EXPORT leveldbTargets
NAMESPACE leveldb::
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/../share/leveldb"
)
install(
FILES
"${PROJECT_SOURCE_DIR}/cmake/leveldbConfig.cmake"
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/../share/leveldb"
)
endif(LEVELDB_INSTALL)

View File

@ -0,0 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1409c06..98b87dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -437,6 +437,12 @@ if(LEVELDB_INSTALL)
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
COMPATIBILITY SameMajorVersion
)
+ configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/leveldbConfig.cmake.in
+ leveldbConfig.cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/leveldb
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ PATH_VARS CMAKE_INSTALL_INCLUDEDIR
+ )
install(
EXPORT leveldbTargets
NAMESPACE leveldb::
@@ -444,7 +450,7 @@ if(LEVELDB_INSTALL)
)
install(
FILES
- "${PROJECT_SOURCE_DIR}/cmake/leveldbConfig.cmake"
+ "${PROJECT_BINARY_DIR}/leveldbConfig.cmake"
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
)

View File

@ -0,0 +1,6 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
set_and_check(leveldb_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
include("${CMAKE_CURRENT_LIST_DIR}/leveldbTargets.cmake")

View File

@ -1,5 +1,9 @@
include(vcpkg_common_functions)
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "leveldb doesn't supports UWP")
endif()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
@ -9,9 +13,11 @@ vcpkg_from_github(
SHA512 f9bbf5f466e7f707b94e19261762319ea9f65d41911690e84f59098551e2e69beccf756a414d705ade74ee96fd979bdb8b94c171c6f2cc83873cbd4a9380dbab
HEAD_REF master
PATCHES
fix-install_path.patch
fix_config.patch
)
file(COPY ${CURRENT_PORT_DIR}/leveldbConfig.cmake.in DESTINATION ${SOURCE_PATH}/cmake)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
@ -20,6 +26,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/leveldb)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)