In the case of: -DCACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG:BOOL=TRUE the variable is parsed out as: CACHE_VARS=-DEXTERNAL_PROJECT_CMAKE_ARG because the parser allows '=' in the variable name. Disallow such a name on the command line.