Skip to content

Commit 41c8d83

Browse files
committed
Align CMake configuration with related projects.
PiperOrigin-RevId: 279238007
1 parent 0c40829 commit 41c8d83

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

CMakeLists.txt

+12-7
Original file line numberDiff line numberDiff line change
@@ -443,23 +443,28 @@ if(LEVELDB_INSTALL)
443443
"${LEVELDB_PUBLIC_INCLUDE_DIR}/table_builder.h"
444444
"${LEVELDB_PUBLIC_INCLUDE_DIR}/table.h"
445445
"${LEVELDB_PUBLIC_INCLUDE_DIR}/write_batch.h"
446-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/leveldb
446+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/leveldb"
447447
)
448448

449449
include(CMakePackageConfigHelpers)
450+
configure_package_config_file(
451+
"cmake/${PROJECT_NAME}Config.cmake.in"
452+
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
453+
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
454+
)
450455
write_basic_package_version_file(
451-
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
452-
COMPATIBILITY SameMajorVersion
456+
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
457+
COMPATIBILITY SameMajorVersion
453458
)
454459
install(
455460
EXPORT leveldbTargets
456461
NAMESPACE leveldb::
457-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
462+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
458463
)
459464
install(
460465
FILES
461-
"cmake/leveldbConfig.cmake"
462-
"${PROJECT_BINARY_DIR}/leveldbConfigVersion.cmake"
463-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/leveldb"
466+
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
467+
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
468+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
464469
)
465470
endif(LEVELDB_INSTALL)

cmake/leveldbConfig.cmake

-1
This file was deleted.

cmake/leveldbConfig.cmake.in

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright 2019 The LevelDB Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file. See the AUTHORS file for names of contributors.
4+
5+
@PACKAGE_INIT@
6+
7+
include("${CMAKE_CURRENT_LIST_DIR}/leveldbTargets.cmake")
8+
9+
check_required_components(leveldb)

0 commit comments

Comments
 (0)