From 7167171a484af3b54e327578b4a4ff0f3e2acbb0 Mon Sep 17 00:00:00 2001 From: Ezra Chung <88335979+eramongodb@users.noreply.github.com> Date: Fri, 16 May 2025 10:49:46 -0500 Subject: [PATCH] CXX-3288 do not initialize ENABLE_TESTS with the auto-downloaded C Driver (#1404) * Include FetchMongoC after top-level cache variables are initialized * Set missing ENABLE_TESTS=ON for macro guard tests --- .evergreen/config_generator/components/macro_guards.py | 4 ++-- .evergreen/generated_configs/tasks.yml | 3 +++ CHANGELOG.md | 4 +++- CMakeLists.txt | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.evergreen/config_generator/components/macro_guards.py b/.evergreen/config_generator/components/macro_guards.py index 423e1b79a4..9ddf26374e 100644 --- a/.evergreen/config_generator/components/macro_guards.py +++ b/.evergreen/config_generator/components/macro_guards.py @@ -47,8 +47,8 @@ def tasks(): Compile.call( build_type='Debug', compiler=compiler, - vars={'COMPILE_MACRO_GUARD_TESTS': 'ON'}, - ) + vars={'COMPILE_MACRO_GUARD_TESTS': 'ON', 'ENABLE_TESTS': 'ON'}, + ), ], ) ) diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index 7e7ad400da..38a0f4e402 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -14187,6 +14187,7 @@ tasks: - func: compile vars: COMPILE_MACRO_GUARD_TESTS: "ON" + ENABLE_TESTS: "ON" build_type: Debug - name: macro-guards-rhel80-clang run_on: rhel80-large @@ -14198,6 +14199,7 @@ tasks: - func: compile vars: COMPILE_MACRO_GUARD_TESTS: "ON" + ENABLE_TESTS: "ON" build_type: Debug cc_compiler: clang cxx_compiler: clang++ @@ -14211,6 +14213,7 @@ tasks: - func: compile vars: COMPILE_MACRO_GUARD_TESTS: "ON" + ENABLE_TESTS: "ON" build_type: Debug cc_compiler: gcc cxx_compiler: g++ diff --git a/CHANGELOG.md b/CHANGELOG.md index 57b1b38f19..b651e1fad1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu ## 4.1.1 [Unreleased] - +### Fixed + +- CMake option `ENABLE_TESTS` (`OFF` by default) is no longer overwritten by the auto-downloaded C Driver (`ON` by default) during CMake configuration. ## 4.1.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 68f6cd58bf..6caee2052f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,6 @@ set(BSON_REQUIRED_VERSION 2.0.0) set(MONGOC_REQUIRED_VERSION 2.0.0) set(MONGOC_DOWNLOAD_VERSION 2.0.0) -include(FetchMongoC) - # All of our target compilers support the deprecated # attribute. Normally, we would just let the GenerateExportHeader # subsystem do this via configure check, but there appears to be a @@ -321,6 +319,8 @@ if(ENABLE_TESTS) enable_testing() endif() +include(FetchMongoC) + add_subdirectory(src) add_subdirectory(examples EXCLUDE_FROM_ALL)