CMake empty or wrong CMAKE_BUILD_TYPE in CI
With single-config generators (Unix Makefiles, Ninja), CMAKE_BUILD_TYPE selects the optimization and flags. When it is empty or misspelled, CMake builds with no optimization or ignores your intended profile, producing slow or wrong binaries in CI.
What this error means
The build succeeds but binaries are unoptimized, or a build-type-specific step behaves oddly, because CMAKE_BUILD_TYPE was empty or set to a value CMake does not recognize such as "release" instead of "Release".
-- Build type not specified, using no optimization flags
-- CMAKE_BUILD_TYPE=''Common causes
CMAKE_BUILD_TYPE was never passed
Single-config generators default to an empty build type, so no -O flags are applied and the binary is unoptimized.
The value is misspelled or wrong case
CMake compares against Debug, Release, RelWithDebInfo, MinSizeRel; "release" or "prod" does not match a known configuration.
How to fix it
Pass an exact build type
Set CMAKE_BUILD_TYPE to a recognized value at configure time for single-config generators.
cmake -S . -B build -DCMAKE_BUILD_TYPE=ReleaseSelect config at build time for multi-config
With multi-config generators, pass --config at build time instead of CMAKE_BUILD_TYPE.
cmake --build build --config ReleaseHow to prevent it
- Always set CMAKE_BUILD_TYPE explicitly for Makefiles/Ninja.
- Use the exact capitalization: Debug, Release, RelWithDebInfo, MinSizeRel.
- Encode the build type in a CMake preset so CI cannot forget it.