Skip to content

Commit 51c4708

Browse files
authored
CXX-2749 Use FetchContent and find_package() to obtain mnmlstc/core (#1019)
* Print name of example project being tested on failure * Use FetchContent and find_package() to obtain mnmlstc/core * Update documentation to remove special handling of mnmlstc/core * Remove obsoleted special handling of mnmlstc/core * Bump minimum CMake version to 3.15
1 parent 60a3e7c commit 51c4708

File tree

25 files changed

+125
-131
lines changed

25 files changed

+125
-131
lines changed

.evergreen/build_example_projects.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ for project in bsoncxx mongocxx; do
1515
cd $project
1616

1717
if ! ( cd cmake/$DIR && ./build.sh >|output.txt 2>&1); then
18+
echo "Example $project/cmake/$DIR failed" 1>&2
1819
cat cmake/$DIR/output.txt 1>&2
1920
exit 1
2021
fi
2122

2223
if ! ( cd cmake-deprecated/$DIR && ./build.sh >|output.txt 2>&1); then
24+
echo "Example $project/cmake-deprecated/$DIR failed" 1>&2
2325
cat cmake-deprecated/$DIR/output.txt 1>&2
2426
exit 1
2527
fi
2628

2729
if [[ ! ( "$OSTYPE" =~ cygwin ) ]]; then
2830
if ! ( cd pkg-config/$DIR && ./build.sh >|output.txt 2>&1); then
31+
echo "Example $project/pkg-config/$DIR failed" 1>&2
2932
cat pkg-config/$DIR/output.txt 1>&2
3033
exit 1
3134
fi

.ycm_extra_conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
'-x', 'c++',
4646
'-Isrc',
4747
'-Ibuild/src',
48-
'-Ibuild/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core/include',
4948
'-Isrc/third_party/catch/include',
5049
'-I/usr/local/include/libmongoc-1.0',
5150
'-I/usr/local/include/libbson-1.0',

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### Changed
1818
- Do not build tests as part of `all` target. Configure with `BUILD_TESTING=ON` to build tests.
19+
- Bump minimum required CMake version to 3.15 to support the FetchContent module and for consistency with the C Driver.
20+
- Improve handling of downloaded (non-system) mnmlstc/core as the polyfill library.
21+
- Use `FetchContent` instead of `ExternalProject` to download and build the library.
22+
- Do not patch include directives in mnmlstc/core headers.
1923

2024
### Fixed
2125
- Explicitly document that throwing an exception from an APM callback is undefined behavior.
26+
- Do not prematurely install mnmlstc/core headers during the CMake build step.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
15+
cmake_minimum_required(VERSION 3.15)
1616

1717
if(POLICY CMP0025)
1818
cmake_policy(SET CMP0025 NEW)

cmake/BsoncxxUtil.cmake

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,15 @@ function(bsoncxx_add_library TARGET OUTPUT_NAME LINK_TYPE)
2929
endif()
3030

3131
if(BSONCXX_POLY_USE_MNMLSTC AND NOT BSONCXX_POLY_USE_SYSTEM_MNMLSTC)
32-
add_dependencies(${TARGET} EP_mnmlstc_core)
33-
ExternalProject_Get_Property(EP_mnmlstc_core source_dir)
3432
target_include_directories(
3533
${TARGET}
3634
PUBLIC
37-
$<BUILD_INTERFACE:${source_dir}/include>
38-
$<BUILD_INTERFACE:${CMAKE_INSTALL_PREFIX}/${BSONCXX_HEADER_INSTALL_DIR}>
35+
$<BUILD_INTERFACE:${CORE_INCLUDE_DIR}>
36+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/v_noabi/bsoncxx/third_party/mnmlstc>
3937
)
4038
elseif(BSONCXX_POLY_USE_BOOST)
4139
find_package(Boost 1.56.0 REQUIRED)
42-
if(CMAKE_VERSION VERSION_LESS 3.15.0)
43-
target_include_directories(${TARGET} PUBLIC ${Boost_INCLUDE_DIRS})
44-
else()
45-
target_link_libraries(${TARGET} PUBLIC Boost::boost)
46-
endif()
40+
target_link_libraries(${TARGET} PUBLIC Boost::boost)
4741
endif()
4842

4943
target_link_libraries(${TARGET} PRIVATE ${libbson_target})

cmake/make_dist/MakeDist.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ include (MakeDistFiles)
1717
function (MAKE_DIST PACKAGE_PREFIX MONGOCXX_SOURCE_DIR BUILD_SOURCE_DIR)
1818

1919
set (CMAKE_COMMAND_TMP "")
20-
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
21-
set (CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
22-
endif ()
20+
set (CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
2321

2422
# -- Remove any existing packaging directory.
2523

cmake/make_dist/MakeDistCheck.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ function (RUN_DIST_CHECK PACKAGE_PREFIX EXT)
1717
endif ()
1818

1919
set (MY_CMAKE_COMMAND "")
20-
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
21-
set (MY_CMAKE_COMMAND ${CMAKE_COMMAND} -E env)
22-
endif ()
20+
set (MY_CMAKE_COMMAND ${CMAKE_COMMAND} -E env)
2321

2422
find_program (MAKE_COMMAND NAMES make gmake)
2523
if (${MAKE_COMMAND} STREQUAL "MAKE_COMMAND-NOTFOUND")

cmake/make_dist/MakeDistFiles.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
2-
if (${CMAKE_VERSION} VERSION_LESS 3.3)
3-
include (CMakeParseArguments)
4-
endif ()
5-
61
function (SET_LOCAL_DIST output)
72
set (dist_files "")
83
foreach (file ${ARGN})

debian/patches/0002_skip_mnmlstc_extra_step.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.

debian/patches/series

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
0001_remove_embedded_js.patch
2-
0002_skip_mnmlstc_extra_step.patch

0 commit comments

Comments
 (0)