In fact, strange behavior! I don't have an windows machine lately, so I can't test/correct this for now...

I guess you run cmake with an empty cache or with  DirectX_FOUND set to false? In other case, this part of this file is not run...