-
Notifications
You must be signed in to change notification settings - Fork 99
[MONGOCRYPT-874] Refactor build scripts to use more standard environment variable controls for CMake #1110
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
Merged
vector-of-bool
merged 17 commits into
mongodb:master
from
vector-of-bool:feature/env-refactor.2
Jan 23, 2026
Merged
[MONGOCRYPT-874] Refactor build scripts to use more standard environment variable controls for CMake #1110
vector-of-bool
merged 17 commits into
mongodb:master
from
vector-of-bool:feature/env-refactor.2
Jan 23, 2026
+105
−134
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eramongodb
requested changes
Jan 22, 2026
rcsanchez97
approved these changes
Jan 23, 2026
eramongodb
approved these changes
Jan 23, 2026
Comment on lines
+68
to
+71
| # Prepend our custom C and CXX flags for any possible CMake builds | ||
| CFLAGS="$LIBMONGOCRYPT_COMPILE_FLAGS ${CFLAGS-}" \ | ||
| CXXFLAGS="$LIBMONGOCRYPT_COMPILE_FLAGS ${CXXFLAGS-}" \ | ||
| run_cmake "$@" |
Contributor
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.
Curious: why prepend instead of append?
Contributor
Author
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.
No reason at all, just how I happened to write it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refer: MONGOCRYPT-874
This changeset simplifies the build scripts by removing custom environment variables, as well as some legacy cruft that is no longer relevant. It can be viewed on a per-commit basis.
Summary
-Aand-Twhen invoking CMake. These are no longer relevant since we use Ninja on Windows andvs-env-run.ps1sets the environment for us. Besides, the proper way to do that would be to use theCMAKE_GENERATOR_PLATFORMANDCMAKE_GENERATOR_TOOLSETenvironment variables to control the target for the VS (MSBuild) CMake generator.EXTRA_CFLAGSin favor of usingCFLAGSandCXXFLAGS, which are recognized by CMake to initializeCMAKE_C_FLAGSandCMAKE_CXX_FLAGS. These are standard across build tools.MACOS_UNIVERSALenvironment variable control in favor of CMake's standardCMAKE_OSX_ARCHITECTURESflag. The test case that asserts we generate a multi-arch binary remains.-Gflag and theuse_ninjaexpansion/environment variable in favor of using theCMAKE_GENERATORenvironment variable.uvto manage Ninja, theensure-ninja.shand related scripts should be removed and our build scripts should not acknowledge the generator.build_all.shCMAKE_BUILD_TYPE,CMAKE_CONFIG_TYPE(controls the default for--buildandctest),CMAKE_INSTALL_PREFIX, andCMAKE_EXPORT_COMPILE_COMMANDS.build_all.shis now shellcheck-clean.CCandCXXto control the compiler executables, not by settingCMAKE_C_COMPILERandCMAKE_CXX_COMPILER.LIBMONGOCRYPT_EXTRA_CMAKE_FLAGSADDITIONAL_CMAKE_FLAGSDEFAULT_BUILD_ONLYcontrol. This didn't appear to be used anywhere.--freshinbuild_all.shwhen we invoke CMake each time.-EHscon Windows. This was incorrect because it should be checking for MSVC. It doesn't appear to have any effect on the build?MAKEFLAGSto control parallelism. CMake respectsCMAKE_BUILD_PARALLEL_LEVELenvironment variable to control parallelism regardless of the underlying build tool.