From what I remember, you can not use $<CONFIG> like that, as this is a generator expression, so it doesn’t get evaluated at that stage. You probably should use CMAKE_BUILD_TYPE instead, but that will work only with single-config generators (such as Ninja); while with multi-config generators (such as Visual Studio) it will be either empty or some auto-detected default value, so it isn’t reliable (unless you provide it with -D or environment variable).