the CCW alone does not grant "lawful purpose," but if your purpose in the building is lawful, and the carriage of the firearm is lawful, the one may protect the other,
Except that federal property is NOT part of the state it is located in, and your permit is no more valid there than in a neighboring state (absent agreed upon reciprocity).
Neither local nor state police have jurisdiction on federal property unless specifically granted.
You are going to have a very hard time convincing a federal judge that the statute is anything but a prohibition on the carry of non-government sanctioned firearms in a federal facility.
It has probably not been seriously challenged since it is rather obvious what the intent of the law is.