mysql-connector fails to build if either CFLAGS or CXXFLAGS are unset in a misleading way throwing CMake Error at CMakeLists.txt:879 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. CMake Error at CMakeLists.txt:881 (STRING): STRING sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. Reproducible: Always I suggest to add a direct check weather CFLAGS/CXXFLAGS are empty before proceeding with configure and if they are - throw a meaningful message like CFLAGS are empty, please configure CFLAGS/CXXFLAGS