-
Notifications
You must be signed in to change notification settings - Fork 455
Simplify Deprecated CMake Packages as Wrappers Around Current Packages #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d8bbdc9
d155194
cbfc752
669140e
0aa77f5
fd0cc6a
bbcbf48
d8fdfcc
77c39af
20f34aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
include (CMakePackageConfigHelpers) | ||
|
||
# These aren't pkg-config files, they're CMake package configuration files. | ||
function (install_package_config_file prefix) | ||
foreach (suffix "config.cmake") | ||
configure_package_config_file ( | ||
${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-${prefix}-${suffix}.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${prefix}-${suffix} | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${prefix} | ||
) | ||
|
||
install ( | ||
FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${prefix}-${suffix} | ||
DESTINATION | ||
${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${prefix} | ||
) | ||
endforeach () | ||
write_basic_package_version_file( | ||
${PROJECT_NAME}-${prefix}-config-version.cmake | ||
VERSION "${PROJECT_VERSION}" | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${prefix}-config-version.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${prefix}) | ||
endfunction () | ||
|
||
install_package_config_file ("1.0") | ||
|
||
if (ENABLE_STATIC) | ||
install_package_config_file ("static-1.0") | ||
endif () |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2017 MongoDB Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if(NOT libbson-static-1.0_FIND_QUIETLY) | ||
message(WARNING "This CMake package is deprecated. Prefer instead to use the \"bson-1.0\" package and link to mongo::bson_static.") | ||
endif() | ||
|
||
set (BSON_STATIC_MAJOR_VERSION @libbson_VERSION_MAJOR@) | ||
set (BSON_STATIC_MINOR_VERSION @libbson_VERSION_MINOR@) | ||
set (BSON_STATIC_MICRO_VERSION @libbson_VERSION_PATCH@) | ||
set (BSON_STATIC_VERSION @libbson_VERSION@) | ||
set (BSON_STATIC_VERSION_FULL @libbson_VERSION_FULL@) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(bson-1.0) | ||
|
||
set (BSON_STATIC_LIBRARY mongo::bson_static) | ||
set (BSON_STATIC_LIBRARIES mongo::bson_static) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2017 MongoDB Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if(NOT libmongoc-1.0_FIND_QUIETLY) | ||
message(WARNING "This CMake package is deprecated. Prefer instead to use the \"mongoc-1.0\" package and link to mongo::mongoc_shared.") | ||
endif() | ||
|
||
set (MONGOC_MAJOR_VERSION @libmongoc_VERSION_MAJOR@) | ||
set (MONGOC_MINOR_VERSION @libmongoc_VERSION_MINOR@) | ||
set (MONGOC_MICRO_VERSION @libmongoc_VERSION_PATCH@) | ||
set (MONGOC_VERSION @libmongoc_VERSION@) | ||
set (MONGOC_VERSION_FULL @libmongoc_VERSION_FULL@) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency (mongoc-1.0) | ||
|
||
set(MONGOC_LIBRARY mongo::mongoc_shared) | ||
set(MONGOC_LIBRARIES mongo::mongoc_shared) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2017 MongoDB Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if(NOT libmongoc-static-1.0_FIND_QUIETLY) | ||
message(WARNING "This CMake package is deprecated. Prefer instead to use the \"mongoc-1.0\" package and link to mongo::mongoc_static.") | ||
endif() | ||
|
||
set (MONGOC_STATIC_MAJOR_VERSION @libmongoc_VERSION_MAJOR@) | ||
set (MONGOC_STATIC_MINOR_VERSION @libmongoc_VERSION_MINOR@) | ||
set (MONGOC_STATIC_MICRO_VERSION @libmongoc_VERSION_PATCH@) | ||
set (MONGOC_STATIC_VERSION @libmongoc_VERSION@) | ||
set (MONGOC_STATIC_VERSION_FULL @libmongoc_VERSION_FULL@) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency (mongoc-1.0) | ||
|
||
set(MONGOC_STATIC_LIBRARY mongo::mongoc_static) | ||
set(MONGOC_STATIC_LIBRARIES mongo::mongoc_static) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
cmake_minimum_required (VERSION 3.15) | ||
|
||
project (libbson C) | ||
project (libbson | ||
LANGUAGES C | ||
# Inherit the version from mongo-c-driver | ||
VERSION "${PROJECT_VERSION}" | ||
DESCRIPTION "The libbson BSON serialization library" | ||
) | ||
|
||
# These values are inherited from the mongo-c-driver parent. These are named as to | ||
# match the CMake variables generated by project(). | ||
set(libbson_VERSION_PRERELEASE ${mongo-c-driver_VERSION_PRERELEASE}) | ||
set(libbson_VERSION_FULL ${mongo-c-driver_VERSION_FULL}) | ||
|
||
# In the future we may need to check whether static dependencies are | ||
# available. For now, AUTO means ON. | ||
|
@@ -23,18 +33,11 @@ include (InstallRequiredSystemLibraries) | |
|
||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/build/cmake) | ||
|
||
# Set BSON_MAJOR_VERSION, BSON_MINOR_VERSION, etc. | ||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/../../build/cmake) | ||
include (LoadVersion) | ||
LoadVersion (${PROJECT_SOURCE_DIR}/../../VERSION_CURRENT BSON) | ||
|
||
message (STATUS "lib${BSON_OUTPUT_BASENAME} version (from VERSION_CURRENT file): ${BSON_VERSION}") | ||
set(CMAKE_C_VISIBILITY_PRESET hidden) | ||
set(CMAKE_CXX_VISIBILITY_PRESET hidden) | ||
|
||
set (BSON_API_VERSION 1.0) | ||
|
||
set (CPACK_PACKAGE_VERSION_MAJOR ${BSON_MAJOR_VERSION}) | ||
set (CPACK_PACKAGE_VERSION_MINOR ${BSON_MINOR_VERSION}) | ||
|
||
include (CPack) | ||
TEST_BIG_ENDIAN (BSON_BIG_ENDIAN) | ||
|
||
|
@@ -267,9 +270,6 @@ endif () | |
if (WIN32) | ||
# gethostbyname | ||
target_link_libraries (bson_shared PRIVATE ws2_32) | ||
# Can't find_library () system dependencies | ||
# must be handled specially since we can't resolve them | ||
set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) | ||
endif () | ||
|
||
if (MONGOC_ENABLE_STATIC_BUILD) | ||
|
@@ -367,11 +367,6 @@ install ( | |
INCLUDES DESTINATION ${BSON_HEADER_INSTALL_DIR} | ||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
set_target_properties(${TARGETS_TO_INSTALL} PROPERTIES | ||
pkg_config_NAME libbson | ||
pkg_config_DESCRIPTION "The libbson BSON serialization library." | ||
pkg_config_VERSION "${BSON_VERSION}" | ||
) | ||
Comment on lines
-370
to
-374
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inferred from |
||
set_property(TARGET ${TARGETS_TO_INSTALL} APPEND PROPERTY pkg_config_INCLUDE_DIRECTORIES "${BSON_HEADER_INSTALL_DIR}") | ||
|
||
install ( | ||
|
@@ -390,22 +385,7 @@ if (ENABLE_APPLE_FRAMEWORK) | |
) | ||
endif () | ||
|
||
set (LIBBSON_LIBRARIES "") | ||
foreach (_lib ${BSON_LIBRARIES}) | ||
if (_lib MATCHES ".*/.*" OR _lib MATCHES "^-") | ||
set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") | ||
else () | ||
set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} -l${_lib}") | ||
endif () | ||
endforeach () | ||
# System dependencies don't match the above regexs, but also don't want the -l | ||
foreach (_lib ${BSON_SYSTEM_LIBRARIES}) | ||
set (LIBBSON_LIBRARIES "${LIBBSON_LIBRARIES} ${_lib}") | ||
endforeach () | ||
|
||
include (CMakePackageConfigHelpers) | ||
set (INCLUDE_INSTALL_DIRS "${BSON_HEADER_INSTALL_DIR}") | ||
set (LIBRARY_INSTALL_DIRS ${CMAKE_INSTALL_LIBDIR}) | ||
Comment on lines
-393
to
-408
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only used by the old script generation during |
||
|
||
write_basic_package_version_file ( | ||
"${CMAKE_CURRENT_BINARY_DIR}/bson/bson-${BSON_API_VERSION}-config-version.cmake" | ||
|
@@ -439,7 +419,7 @@ install ( | |
Devel | ||
) | ||
|
||
include (build/cmake/BSONPackage.cmake) | ||
include (LegacyPackage) | ||
|
||
if (ENABLE_MAN_PAGES STREQUAL ON OR ENABLE_HTML_DOCS STREQUAL ON) | ||
find_package (Sphinx REQUIRED) | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values are inferred from
project()
, which now contains the correct version information.(Not sure if we have many CPack users anyway, though)